fix(minor): discount accounting patch

This commit is contained in:
Rushabh Mehta 2022-05-01 12:25:21 +05:30
parent 54d16de849
commit d746db5547

View File

@ -2,8 +2,10 @@ import frappe
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)