fix: Ignore asset qty and status validation while cancelling LCV
(cherry picked from commit e9d36242ce3e09ee423f917eede2275bded10d6d)
This commit is contained in:
parent
5d6bc96375
commit
87d1b0f476
@ -194,7 +194,8 @@ class LandedCostVoucher(Document):
|
|||||||
for d in self.get("purchase_receipts"):
|
for d in self.get("purchase_receipts"):
|
||||||
doc = frappe.get_doc(d.receipt_document_type, d.receipt_document)
|
doc = frappe.get_doc(d.receipt_document_type, d.receipt_document)
|
||||||
# check if there are {qty} assets created and linked to this receipt document
|
# check if there are {qty} assets created and linked to this receipt document
|
||||||
self.validate_asset_qty_and_status(d.receipt_document_type, doc)
|
if self.docstatus != 2:
|
||||||
|
self.validate_asset_qty_and_status(d.receipt_document_type, doc)
|
||||||
|
|
||||||
# set landed cost voucher amount in pr item
|
# set landed cost voucher amount in pr item
|
||||||
doc.set_landed_cost_voucher_amount()
|
doc.set_landed_cost_voucher_amount()
|
||||||
@ -235,20 +236,20 @@ class LandedCostVoucher(Document):
|
|||||||
filters={receipt_document_type: item.receipt_document, "item_code": item.item_code},
|
filters={receipt_document_type: item.receipt_document, "item_code": item.item_code},
|
||||||
fields=["name", "docstatus"],
|
fields=["name", "docstatus"],
|
||||||
)
|
)
|
||||||
if not docs or len(docs) != item.qty:
|
if not docs or len(docs) < item.qty:
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_(
|
_(
|
||||||
"There are not enough asset created or linked to {0}. Please create or link {1} Assets with respective document."
|
"There are only {0} asset created or linked to {1}. Please create or link {2} Assets with respective document."
|
||||||
).format(item.receipt_document, item.qty)
|
).format(len(docs), item.receipt_document, item.qty)
|
||||||
)
|
)
|
||||||
if docs:
|
if docs:
|
||||||
for d in docs:
|
for d in docs:
|
||||||
if d.docstatus == 1:
|
if d.docstatus == 1:
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_(
|
_(
|
||||||
"{2} <b>{0}</b> has submitted Assets. Remove Item <b>{1}</b> from table to continue."
|
"{0} <b>{1}</b> has submitted Assets. Remove Item <b>{2}</b> from table to continue."
|
||||||
).format(
|
).format(
|
||||||
item.receipt_document, item.item_code, item.receipt_document_type
|
item.receipt_document_type, item.receipt_document, item.item_code
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user