Merge branch 'separate-discount-account' of github.com:rahib-hassan/erpnext into separate-discount-account
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index a3bf78b..24354c3 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -364,3 +364,4 @@
 erpnext.patches.v13_0.set_return_against_in_pos_invoice_references
 erpnext.patches.v13_0.remove_unknown_links_to_prod_plan_items # 24-03-2022
 erpnext.patches.v13_0.update_expense_claim_status_for_paid_advances
+erpnext.patches.v14_0.discount_accounting_separation
\ No newline at end of file
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 0000000..3d4907c
--- /dev/null
+++ b/erpnext/patches/v14_0/discount_accounting_separation.py
@@ -0,0 +1,8 @@
+import frappe
+
+def execute():
+    doc = frappe.get_doc("Accounts Settings")
+    discount_account = doc.enable_discount_accounting
+    if discount_account:
+        for doctype in ["Buying Settings", "Selling Settings"]:
+            doc = frappe.db.set_value(doctype, doctype, 'enable_discount_accounting', 1, update_modified=False)
\ No newline at end of file