mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-26 10:08:30 +00:00
Merge pull request #45585 from ruthra-kumar/auto_add_taxes
refactor: auto add taxes from template
This commit is contained in:
@@ -255,6 +255,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
|
||||
@@ -974,6 +976,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