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() {
this.get_all_asset_values();
finance_book(doc, cdt, cdn) {
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() {
@ -268,7 +273,7 @@ erpnext.assets.AssetCapitalization = class AssetCapitalization extends erpnext.s
doctype: me.frm.doc.doctype,
name: me.frm.doc.name,
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_time: me.frm.doc.posting_time,
}

View File

@ -72,6 +72,7 @@ class AssetCapitalization(AccountsController):
args.update(d.as_dict())
args.doctype = self.doctype
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)
for k, v in consumed_asset_details.items():
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):
for d in self.asset_items:
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):
return frappe._dict({

View File

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