diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 2a97061a6a2..637ce3dbed1 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -374,4 +374,5 @@ erpnext.patches.v15_0.do_not_use_batchwise_valuation erpnext.patches.v15_0.drop_index_posting_datetime_from_sle erpnext.patches.v15_0.add_disassembly_order_stock_entry_type #1 erpnext.patches.v15_0.set_standard_stock_entry_type +erpnext.patches.v15_0.set_difference_amount_in_asset_value_adjustment erpnext.patches.v15_0.link_purchase_item_to_asset_doc diff --git a/erpnext/patches/v15_0/link_purchase_item_to_asset_doc.py b/erpnext/patches/v15_0/link_purchase_item_to_asset_doc.py index e5386c1de0a..662858e52a4 100644 --- a/erpnext/patches/v15_0/link_purchase_item_to_asset_doc.py +++ b/erpnext/patches/v15_0/link_purchase_item_to_asset_doc.py @@ -65,9 +65,10 @@ def get_linked_item(doctype, parent, item_code, amount, quantity): if quantity > 1: if item.amount + landed_cost == amount and item.qty == quantity: return item.name + elif item.qty == quantity: + return item.name else: - if item.rate + landed_cost == amount: + if item.rate + (landed_cost / item.qty) == amount: return item.name - # If no exact match, return None - return None + return items[0].name if items else None