Added default asset accounts in COA, CWIP account in asset category

This commit is contained in:
Rohit Waghchaure
2018-05-08 12:38:28 +05:30
parent 255cd44aba
commit f41e1ed191
8 changed files with 102 additions and 21 deletions

View File

@@ -40,5 +40,16 @@ frappe.ui.form.on('Asset Category', {
};
});
frm.set_query('capital_work_in_progress_account', 'accounts', function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
return {
"filters": {
"account_type": "Capital Work in Progress",
"is_group": 0,
"company": d.company_name
}
};
});
}
});

View File

@@ -13,3 +13,10 @@ class AssetCategory(Document):
for field in ("total_number_of_depreciations", "frequency_of_depreciation"):
if cint(self.get(field))<1:
frappe.throw(_("{0} must be greater than 0").format(self.meta.get_label(field)), frappe.MandatoryError)
def get_cwip_account(item_code, company):
asset_category = frappe.db.get_value('Item', item_code, 'asset_category')
cwip_account = frappe.db.get_value('Asset Category Account',
{'parent': asset_category, 'company_name': company}, 'capital_work_in_progress_account')
return cwip_account or None

View File

@@ -41,6 +41,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -72,6 +73,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -103,6 +105,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -134,6 +137,39 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "capital_work_in_progress_account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Capital Work In Progress Account",
"length": 0,
"no_copy": 0,
"options": "Account",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
@@ -147,7 +183,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2017-11-28 16:54:12.252271",
"modified": "2018-05-08 11:41:09.678234",
"modified_by": "Administrator",
"module": "Assets",
"name": "Asset Category Account",