mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 11:19:09 +00:00
feat: Disable CWIP Accounting checkbox added in Company and Asset Category (#19262)
* feat: Disable CWIP Accounting checkbox added in Company and Asset Category Asset Settings is removed completely Disable CWIP Accounting checkbox will give priority to Asset Category * fix: Changed checkbox name to 'Enable Capital Work in Progress Accounting' - checkbox will be disabled by default - Enabling it in Company will globally enable it - When globally disabled , it's value on the asset category will be considered * chore: Added patch to set pre-existing CWIP checkbox value into new checkbox * fix(test): Asset * fix: Asset Test and Patch * fix(test): Opening Invoice Creation Tool * Update asset.py * fix: Patch and other fixes
This commit is contained in:
22
erpnext/patches/v12_0/set_cwip_and_delete_asset_settings.py
Normal file
22
erpnext/patches/v12_0/set_cwip_and_delete_asset_settings.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils import cint
|
||||
|
||||
|
||||
def execute():
|
||||
'''Get 'Disable CWIP Accounting value' from Asset Settings, set it in 'Enable Capital Work in Progress Accounting' field
|
||||
in Company, delete Asset Settings '''
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
frappe.db.sql(
|
||||
""" DELETE FROM `tabSingles` where doctype = 'Asset Settings' """)
|
||||
frappe.delete_doc_if_exists("DocType","Asset Settings")
|
||||
Reference in New Issue
Block a user