fix(Asset): Replace asset_value with value_after_depreciation in Finance Books

This commit is contained in:
GangaManoj 2021-06-17 13:02:02 +05:30
parent d354a301cb
commit 50826f16ee
4 changed files with 19 additions and 19 deletions

View File

@ -23,7 +23,6 @@
"asset_name",
"asset_category",
"location",
"asset_value",
"custodian",
"department",
"disposal_date",
@ -484,12 +483,6 @@
"fieldtype": "Section Break",
"label": "Finance Books"
},
{
"fieldname": "asset_value",
"fieldtype": "Currency",
"label": "Asset Value",
"read_only": 1
},
{
"fieldname": "to_date",
"fieldtype": "Date",
@ -523,7 +516,7 @@
"link_fieldname": "asset"
}
],
"modified": "2021-05-21 12:05:29.424083",
"modified": "2021-06-17 12:59:39.189106",
"modified_by": "Administrator",
"module": "Assets",
"name": "Asset",

View File

@ -96,9 +96,6 @@ class Asset(AccountsController):
finance_books = get_item_details(self.item_code, self.asset_category)
self.set('finance_books', finance_books)
if not(self.asset_value):
self.asset_value = self.gross_purchase_amount
def validate_asset_values(self):
if not self.asset_category:
self.asset_category = frappe.get_cached_value("Item", self.item_code, "asset_category")
@ -187,8 +184,12 @@ class Asset(AccountsController):
start = n
break
value_after_depreciation = (flt(self.asset_value) -
flt(self.opening_accumulated_depreciation)) - flt(d.expected_value_after_useful_life)
if d.value_after_depreciation:
value_after_depreciation = (flt(d.value_after_depreciation) -
flt(self.opening_accumulated_depreciation)) - flt(d.expected_value_after_useful_life)
else:
value_after_depreciation = (flt(self.gross_purchase_amount) -
flt(self.opening_accumulated_depreciation)) - flt(d.expected_value_after_useful_life)
d.value_after_depreciation = value_after_depreciation

View File

@ -84,7 +84,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-06-17 08:02:32.650738",
"modified": "2021-06-17 12:59:05.743683",
"modified_by": "Administrator",
"module": "Assets",
"name": "Asset Finance Book",

View File

@ -61,13 +61,19 @@ class AssetRepair(AccountsController):
frappe.throw(_("Please enter Warehouse from which Stock Items consumed during the Repair were taken."), title=_("Missing Warehouse"))
def increase_asset_value(self):
asset_value = frappe.db.get_value('Asset', self.asset, 'asset_value')
total_value_of_stock_consumed = 0
for item in self.stock_items:
asset_value += item.total_value
total_value_of_stock_consumed += item.total_value
if self.capitalize_repair_cost:
asset_value += self.repair_cost
frappe.db.set_value('Asset', self.asset, 'asset_value', asset_value)
asset = frappe.get_doc('Asset', self.asset)
asset.flags.ignore_validate_update_after_submit = True
if asset.calculate_depreciation:
for row in asset.finance_books:
row.value_after_depreciation += total_value_of_stock_consumed
if self.capitalize_repair_cost:
row.value_after_depreciation += self.repair_cost
asset.save()
def decrease_stock_quantity(self):
stock_entry = frappe.get_doc({