Skip to content

Commit e7e6567

Browse files
committed
fix(asset): skip purchase document validation while splitting existing asset
1 parent 9eeccb7 commit e7e6567

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

erpnext/assets/doctype/asset/asset.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,9 @@ def validate_asset_values(self):
482482
frappe.throw(_("Available-for-use Date should be after purchase date"))
483483

484484
def validate_linked_purchase_documents(self):
485+
if self.flags.is_split_asset:
486+
return
487+
485488
for fieldname, doctype in [
486489
("purchase_receipt", "Purchase Receipt"),
487490
("purchase_invoice", "Purchase Invoice"),
@@ -1378,6 +1381,7 @@ def process_asset_split(existing_asset, split_qty, splitted_asset=None, is_new_a
13781381
scaling_factor = flt(split_qty) / flt(existing_asset.asset_quantity)
13791382
new_asset = frappe.copy_doc(existing_asset) if is_new_asset else splitted_asset
13801383
asset_doc = new_asset if is_new_asset else existing_asset
1384+
asset_doc.flags.is_split_asset = True
13811385

13821386
set_split_asset_values(asset_doc, scaling_factor, split_qty, existing_asset, is_new_asset)
13831387
log_asset_activity(existing_asset, asset_doc, splitted_asset, is_new_asset)

0 commit comments

Comments
 (0)