fix: Display Discount Account only if Enable Discount Accounting is checked

This commit is contained in:
GangaManoj 2021-07-13 02:07:46 +05:30 committed by Deepesh Garg
parent bde5c619db
commit e2c83c3baf

View File

@ -38,5 +38,7 @@ class AccountsSettings(Document):
def toggle_discount_accounting_fields(self):
enable_discount_accounting = cint(self.enable_discount_accounting)
make_property_setter("Sales Invoice Item", "discount_account", "hidden", not(enable_discount_accounting), "Check", validate_fields_for_doctype=False)
for doctype in ["Sales Invoice Item", "Purchase Invoice Item"]:
make_property_setter(doctype, "discount_account", "hidden", not(enable_discount_accounting), "Check", validate_fields_for_doctype=False)
make_property_setter("Item", "default_discount_account", "hidden", not(enable_discount_accounting), "Check", validate_fields_for_doctype=False)