mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-23 20:16:40 +00:00
fix(buying): allow purchase returns against a closed purchase order (#58126)
This commit is contained in:
@@ -929,6 +929,13 @@ class BuyingController(SubcontractingController):
|
||||
item.serial_and_batch_bundle, warehouse, type_of_transaction=type_of_transaction
|
||||
)
|
||||
|
||||
def check_purchase_order_on_hold_or_close(self, ref_fieldname, exclude_if_field=None):
|
||||
if self.get("is_return"):
|
||||
return
|
||||
self.check_for_on_hold_or_closed_status(
|
||||
"Purchase Order", ref_fieldname, exclude_if_field=exclude_if_field
|
||||
)
|
||||
|
||||
def update_ordered_and_reserved_qty(self):
|
||||
po_map = {}
|
||||
for d in self.get("items"):
|
||||
@@ -942,7 +949,7 @@ class BuyingController(SubcontractingController):
|
||||
if po and po_item_rows:
|
||||
po_obj = frappe.get_lazy_doc("Purchase Order", po)
|
||||
|
||||
if po_obj.status in ["Closed", "Cancelled"]:
|
||||
if po_obj.status == "Cancelled" or (po_obj.status == "Closed" and not self.get("is_return")):
|
||||
frappe.throw(
|
||||
_("{doctype} {name} is cancelled or closed.").format(
|
||||
doctype=frappe.bold(_("Purchase Order")),
|
||||
|
||||
Reference in New Issue
Block a user