mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-19 04:59:18 +00:00
fix: auto cancel if movement exists (#20268)
Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
@@ -132,9 +132,10 @@ class Asset(AccountsController):
|
|||||||
if len(movements) > 1:
|
if len(movements) > 1:
|
||||||
frappe.throw(_('Asset has multiple Asset Movement Entries which has to be \
|
frappe.throw(_('Asset has multiple Asset Movement Entries which has to be \
|
||||||
cancelled manually to cancel this asset.'))
|
cancelled manually to cancel this asset.'))
|
||||||
movement = frappe.get_doc('Asset Movement', movements[0].get('name'))
|
if movements:
|
||||||
movement.flags.ignore_validate = True
|
movement = frappe.get_doc('Asset Movement', movements[0].get('name'))
|
||||||
movement.cancel()
|
movement.flags.ignore_validate = True
|
||||||
|
movement.cancel()
|
||||||
|
|
||||||
def make_asset_movement(self):
|
def make_asset_movement(self):
|
||||||
reference_doctype = 'Purchase Receipt' if self.purchase_receipt else 'Purchase Invoice'
|
reference_doctype = 'Purchase Receipt' if self.purchase_receipt else 'Purchase Invoice'
|
||||||
|
|||||||
Reference in New Issue
Block a user