File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -669,7 +669,10 @@ def set_status(self, status=None):
669669 def get_status (self ):
670670 """Returns status based on whether it is draft, submitted, scrapped or depreciated"""
671671 if self .docstatus == 0 :
672- status = "Draft"
672+ if self .is_composite_asset :
673+ status = "Work In Progress"
674+ else :
675+ status = "Draft"
673676 elif self .docstatus == 1 :
674677 status = "Submitted"
675678
Original file line number Diff line number Diff line change @@ -611,14 +611,15 @@ def update_target_asset(self):
611611
612612 asset_doc = frappe .get_doc ("Asset" , self .target_asset )
613613 if self .docstatus == 2 :
614- asset_doc .gross_purchase_amount -= total_target_asset_value
615- asset_doc .purchase_amount -= total_target_asset_value
614+ gross_purchase_amount = asset_doc .gross_purchase_amount - total_target_asset_value
615+ purchase_amount = asset_doc .purchase_amount - total_target_asset_value
616+ asset_doc .db_set ("total_asset_cost" , asset_doc .total_asset_cost - total_target_asset_value )
616617 else :
617- asset_doc .gross_purchase_amount += total_target_asset_value
618- asset_doc .purchase_amount += total_target_asset_value
619- asset_doc . set_status ( "Work In Progress" )
620- asset_doc .flags . ignore_validate = True
621- asset_doc .save ( )
618+ gross_purchase_amount = asset_doc .gross_purchase_amount + total_target_asset_value
619+ purchase_amount = asset_doc .purchase_amount + total_target_asset_value
620+
621+ asset_doc .db_set ( "gross_purchase_amount" , gross_purchase_amount )
622+ asset_doc .db_set ( "purchase_amount" , purchase_amount )
622623
623624 frappe .msgprint (
624625 _ ("Asset {0} has been updated. Please set the depreciation details if any and submit it." ).format (
You can’t perform that action at this time.
0 commit comments