From 35e875c11131465fe41be6a215c74cf81d47e67e Mon Sep 17 00:00:00 2001 From: rahib-hassan Date: Fri, 8 Apr 2022 17:27:53 +0530 Subject: [PATCH] fix(patch): enable discount account in buying and selling if exist in accounts settings --- .../v14_0/discount_accounting_separation.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 erpnext/patches/v14_0/discount_accounting_separation.py diff --git a/erpnext/patches/v14_0/discount_accounting_separation.py b/erpnext/patches/v14_0/discount_accounting_separation.py new file mode 100644 index 00000000000..bb236f783a7 --- /dev/null +++ b/erpnext/patches/v14_0/discount_accounting_separation.py @@ -0,0 +1,14 @@ +import frappe + +def execute(): + doc = frappe.get_doc("Accounts Settings") + discount_account = doc.enable_discount_accounting + if discount_account: + buying_settings = frappe.get_doc("Buying Settings") + selling_settings = frappe.get_doc("Selling Settings") + + buying_settings.enable_discount_accounting = 1 + selling_settings.enable_discount_accounting = 1 + + buying_settings.save() + selling_settings.save() \ No newline at end of file