diff --git a/frappe/model/mapper.py b/frappe/model/mapper.py index 6613026027d..59ac8d1de1c 100644 --- a/frappe/model/mapper.py +++ b/frappe/model/mapper.py @@ -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 ( @@ -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) \ No newline at end of file