Merge pull request #19576 from marination/cwip-patch-fix

fix(patch): Enable CWIP Accounting
This commit is contained in:
Deepesh Garg 2019-11-13 22:18:12 +05:30 committed by GitHub
commit 95a6320459
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,13 +9,12 @@ def execute():
if frappe.db.exists("DocType","Asset Settings"):
frappe.reload_doctype("Company")
cwip_value = frappe.db.sql(""" SELECT value FROM `tabSingles` WHERE doctype='Asset Settings'
and field='disable_cwip_accounting' """, as_dict=1)
cwip_value = frappe.db.get_single_value("Asset Settings","disable_cwip_accounting")
companies = [x['name'] for x in frappe.get_all("Company", "name")]
for company in companies:
enable_cwip_accounting = cint(not cint(cwip_value[0]['value']))
frappe.set_value("Company", company, "enable_cwip_accounting", enable_cwip_accounting)
enable_cwip_accounting = cint(not cint(cwip_value))
frappe.db.set_value("Company", company, "enable_cwip_accounting", enable_cwip_accounting)
frappe.db.sql(
""" DELETE FROM `tabSingles` where doctype = 'Asset Settings' """)