fix: bad condition while checking last asset movement entry (#20047)

This commit is contained in:
Saqib 2019-12-23 16:08:21 +05:30 committed by Nabin Hait
parent 4f18d2548d
commit 06f9538e51

View File

@ -110,7 +110,7 @@ class AssetMovement(Document):
ORDER BY ORDER BY
asm.transaction_date asc asm.transaction_date asc
""", (d.asset, self.company, 'Receipt'), as_dict=1) """, (d.asset, self.company, 'Receipt'), as_dict=1)
if auto_gen_movement_entry[0].get('name') == self.name: if auto_gen_movement_entry and auto_gen_movement_entry[0].get('name') == self.name:
frappe.throw(_('{0} will be cancelled automatically on asset cancellation as it was \ frappe.throw(_('{0} will be cancelled automatically on asset cancellation as it was \
auto generated for Asset {1}').format(self.name, d.asset)) auto generated for Asset {1}').format(self.name, d.asset))