feat(Asset Capitalization): Finance Book field in Asset Row

This commit is contained in:
Saif Ur Rehman 2021-09-12 14:28:14 +05:00
parent 702b5c32c1
commit 3b9bc8e4ef
3 changed files with 20 additions and 7 deletions

View File

@ -136,8 +136,13 @@ erpnext.assets.AssetCapitalization = class AssetCapitalization extends erpnext.s
} }
} }
finance_book() { finance_book(doc, cdt, cdn) {
this.get_all_asset_values(); if (cdt === "Asset Capitalization Asset Item") {
var row = frappe.get_doc(cdt, cdn);
this.get_consumed_asset_details(row);
} else {
this.get_all_asset_values();
}
} }
stock_qty() { stock_qty() {
@ -268,7 +273,7 @@ erpnext.assets.AssetCapitalization = class AssetCapitalization extends erpnext.s
doctype: me.frm.doc.doctype, doctype: me.frm.doc.doctype,
name: me.frm.doc.name, name: me.frm.doc.name,
company: me.frm.doc.company, company: me.frm.doc.company,
finance_book: me.frm.doc.finance_book, finance_book: row.finance_book || me.frm.doc.finance_book,
posting_date: me.frm.doc.posting_date, posting_date: me.frm.doc.posting_date,
posting_time: me.frm.doc.posting_time, posting_time: me.frm.doc.posting_time,
} }

View File

@ -72,6 +72,7 @@ class AssetCapitalization(AccountsController):
args.update(d.as_dict()) args.update(d.as_dict())
args.doctype = self.doctype args.doctype = self.doctype
args.name = self.name args.name = self.name
args.finance_book = d.get('finance_book') or self.get('finance_book')
consumed_asset_details = get_consumed_asset_details(args, get_asset_value=False) consumed_asset_details = get_consumed_asset_details(args, get_asset_value=False)
for k, v in consumed_asset_details.items(): for k, v in consumed_asset_details.items():
if d.meta.has_field(k) and (not d.get(k) or k in force_fields): if d.meta.has_field(k) and (not d.get(k) or k in force_fields):
@ -195,7 +196,7 @@ class AssetCapitalization(AccountsController):
def set_asset_values(self): def set_asset_values(self):
for d in self.asset_items: for d in self.asset_items:
if d.asset: if d.asset:
d.asset_value = flt(get_current_asset_value(d.asset, self.finance_book)) d.asset_value = flt(get_current_asset_value(d.asset, d.get('finance_book') or self.finance_book))
def get_args_for_incoming_rate(self, item): def get_args_for_incoming_rate(self, item):
return frappe._dict({ return frappe._dict({

View File

@ -7,6 +7,7 @@
"field_order": [ "field_order": [
"asset", "asset",
"asset_name", "asset_name",
"finance_book",
"column_break_3", "column_break_3",
"item_code", "item_code",
"item_name", "item_name",
@ -14,9 +15,9 @@
"asset_value", "asset_value",
"column_break_9", "column_break_9",
"accounting_dimensions_section", "accounting_dimensions_section",
"fixed_asset_account", "cost_center",
"dimension_col_break", "dimension_col_break",
"cost_center" "fixed_asset_account"
], ],
"fields": [ "fields": [
{ {
@ -95,12 +96,18 @@
{ {
"fieldname": "dimension_col_break", "fieldname": "dimension_col_break",
"fieldtype": "Column Break" "fieldtype": "Column Break"
},
{
"fieldname": "finance_book",
"fieldtype": "Link",
"label": "Finance Book",
"options": "Finance Book"
} }
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2021-09-08 15:54:24.885547", "modified": "2021-09-08 23:42:25.143272",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Assets", "module": "Assets",
"name": "Asset Capitalization Asset Item", "name": "Asset Capitalization Asset Item",