Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Customer Form): Sales Tax and Template (Functionality) #126 #74

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion frappe/model/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def get_mapped_doc(
table_maps["postprocess"](source_doc, target_doc)
if postprocess:
postprocess(source_doc, target_doc)

set_taxes_and_charges(source_doc, target_doc)
target_doc.set_onload("load_after_mapping", True)

if (
Expand Down Expand Up @@ -282,3 +282,12 @@ def map_child_doc(source_d, target_parent, table_map, source_parent=None, target
target_parent.append(target_parentfield, target_d)

return target_d


def set_taxes_and_charges(source_doc, target_doc):
if source_doc.get("customer") and source_doc.get("company"):
if frappe.get_cached_value("Customer", source_doc.get("customer"), "taxes_and_charges_template"):
from erpnext.accounts.party import set_taxes
from erpnext.accounts.doctype.sales_invoice.pos import update_tax_table
target_doc.taxes_and_charges = set_taxes(source_doc.get("customer"), "Customer", source_doc.get("posting_date"), source_doc.get("company"))
update_tax_table(target_doc)
Comment on lines +288 to +293
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert everything

Loading