mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-13 17:53:49 +00:00
Merge pull request #45588 from frappe/mergify/bp/version-15-hotfix/pr-45585
refactor: auto add taxes from template (backport #45585)
This commit is contained in:
@@ -252,6 +252,8 @@ class AccountsController(TransactionBase):
|
||||
self.validate_deferred_income_expense_account()
|
||||
self.set_inter_company_account()
|
||||
|
||||
self.set_taxes_and_charges()
|
||||
|
||||
if self.doctype == "Purchase Invoice":
|
||||
self.calculate_paid_amount()
|
||||
# apply tax withholding only if checked and applicable
|
||||
@@ -969,6 +971,12 @@ class AccountsController(TransactionBase):
|
||||
):
|
||||
return True
|
||||
|
||||
def set_taxes_and_charges(self):
|
||||
if frappe.db.get_single_value("Accounts Settings", "add_taxes_from_item_tax_template"):
|
||||
if hasattr(self, "taxes_and_charges") and not self.get("taxes") and not self.get("is_pos"):
|
||||
if tax_master_doctype := self.meta.get_field("taxes_and_charges").options:
|
||||
self.append_taxes_from_master(tax_master_doctype)
|
||||
|
||||
def append_taxes_from_master(self, tax_master_doctype=None):
|
||||
if self.get("taxes_and_charges"):
|
||||
if not tax_master_doctype:
|
||||
|
||||
Reference in New Issue
Block a user