mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 03:39:11 +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:
@@ -168,14 +168,20 @@ def validate_account_for_perpetual_inventory(gl_map):
|
||||
StockValueAndAccountBalanceOutOfSync)
|
||||
|
||||
def validate_cwip_accounts(gl_map):
|
||||
if not cint(frappe.db.get_value("Asset Settings", None, "disable_cwip_accounting")) \
|
||||
and gl_map[0].voucher_type == "Journal Entry":
|
||||
cwip_enabled = cint(frappe.get_cached_value("Company",
|
||||
gl_map[0].company, "enable_cwip_accounting"))
|
||||
|
||||
if not cwip_enabled:
|
||||
cwip_enabled = any([cint(ac.enable_cwip_accounting) for ac in frappe.db.get_all("Asset Category","enable_cwip_accounting")])
|
||||
|
||||
if cwip_enabled and gl_map[0].voucher_type == "Journal Entry":
|
||||
cwip_accounts = [d[0] for d in frappe.db.sql("""select name from tabAccount
|
||||
where account_type = 'Capital Work in Progress' and is_group=0""")]
|
||||
|
||||
for entry in gl_map:
|
||||
if entry.account in cwip_accounts:
|
||||
frappe.throw(_("Account: <b>{0}</b> is capital Work in progress and can not be updated by Journal Entry").format(entry.account))
|
||||
frappe.throw(
|
||||
_("Account: <b>{0}</b> is capital Work in progress and can not be updated by Journal Entry").format(entry.account))
|
||||
|
||||
def round_off_debit_credit(gl_map):
|
||||
precision = get_field_precision(frappe.get_meta("GL Entry").get_field("debit"),
|
||||
|
||||
Reference in New Issue
Block a user