mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-27 10:38:30 +00:00
fix: split and set value after depreciation
This commit is contained in:
@@ -1215,6 +1215,10 @@ def update_existing_asset(asset, remaining_qty, new_asset_name):
|
|||||||
opening_accumulated_depreciation = flt(
|
opening_accumulated_depreciation = flt(
|
||||||
(asset.opening_accumulated_depreciation * remaining_qty) / asset.asset_quantity
|
(asset.opening_accumulated_depreciation * remaining_qty) / asset.asset_quantity
|
||||||
)
|
)
|
||||||
|
value_after_depreciation = flt(
|
||||||
|
(asset.value_after_depreciation * remaining_qty) / asset.asset_quantity,
|
||||||
|
asset.precision("gross_purchase_amount"),
|
||||||
|
)
|
||||||
|
|
||||||
frappe.db.set_value(
|
frappe.db.set_value(
|
||||||
"Asset",
|
"Asset",
|
||||||
@@ -1222,6 +1226,7 @@ def update_existing_asset(asset, remaining_qty, new_asset_name):
|
|||||||
{
|
{
|
||||||
"opening_accumulated_depreciation": opening_accumulated_depreciation,
|
"opening_accumulated_depreciation": opening_accumulated_depreciation,
|
||||||
"gross_purchase_amount": remaining_gross_purchase_amount,
|
"gross_purchase_amount": remaining_gross_purchase_amount,
|
||||||
|
"value_after_depreciation": value_after_depreciation,
|
||||||
"asset_quantity": remaining_qty,
|
"asset_quantity": remaining_qty,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -1283,6 +1288,9 @@ def create_new_asset_after_split(asset, split_qty):
|
|||||||
new_asset.opening_accumulated_depreciation = opening_accumulated_depreciation
|
new_asset.opening_accumulated_depreciation = opening_accumulated_depreciation
|
||||||
new_asset.asset_quantity = split_qty
|
new_asset.asset_quantity = split_qty
|
||||||
new_asset.split_from = asset.name
|
new_asset.split_from = asset.name
|
||||||
|
new_asset.value_after_depreciation = flt(
|
||||||
|
(asset.value_after_depreciation * split_qty) / asset.asset_quantity, asset.precision("gross_purchase_amount")
|
||||||
|
)
|
||||||
|
|
||||||
for row in new_asset.get("finance_books"):
|
for row in new_asset.get("finance_books"):
|
||||||
row.value_after_depreciation = flt((row.value_after_depreciation * split_qty) / asset.asset_quantity)
|
row.value_after_depreciation = flt((row.value_after_depreciation * split_qty) / asset.asset_quantity)
|
||||||
|
|||||||
Reference in New Issue
Block a user