fix: purchase return issue

This commit is contained in:
Rohit Waghchaure
2026-01-05 19:45:10 +05:30
parent c7a81161c7
commit d420ec0b22
3 changed files with 127 additions and 27 deletions

View File

@@ -51,7 +51,7 @@ class BuyingController(SubcontractingController):
self.validate_purchase_receipt_if_update_stock()
if self.doctype == "Purchase Receipt" or (self.doctype == "Purchase Invoice" and self.update_stock):
# self.validate_purchase_return()
self.validate_purchase_return()
self.validate_rejected_warehouse()
self.validate_accepted_rejected_qty()
validate_for_items(self)
@@ -682,15 +682,8 @@ class BuyingController(SubcontractingController):
def validate_purchase_return(self):
for d in self.get("items"):
if self.is_return and flt(d.rejected_qty) != 0:
frappe.throw(
_("Row #{idx}: {field_label} is not allowed in Purchase Return.").format(
idx=d.idx,
field_label=_(d.meta.get_label("rejected_qty")),
)
)
# validate rate with ref PR
if self.is_return and not flt(d.rejected_qty) and d.rejected_warehouse:
d.rejected_warehouse = None
# validate accepted and rejected qty
def validate_accepted_rejected_qty(self):