From d746db5547fa12c4f390a487c200cd2d36f18352 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Sun, 1 May 2022 12:25:21 +0530 Subject: [PATCH] fix(minor): discount accounting patch --- erpnext/patches/v14_0/discount_accounting_separation.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/patches/v14_0/discount_accounting_separation.py b/erpnext/patches/v14_0/discount_accounting_separation.py index fd498052d8c2..8157982135d2 100644 --- a/erpnext/patches/v14_0/discount_accounting_separation.py +++ b/erpnext/patches/v14_0/discount_accounting_separation.py @@ -2,8 +2,10 @@ def execute(): - doc = frappe.get_doc("Accounts Settings") - discount_account = doc.enable_discount_accounting + data = frappe.db.sql( + 'select value from tabSingles where doctype="Accounts Settings" and field="enable_discount_accounting"' + ) + discount_account = data and data[0][0] or 0 if discount_account: for doctype in ["Buying Settings", "Selling Settings"]: frappe.db.set_value(doctype, doctype, "enable_discount_accounting", 1, update_modified=False)