mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-29 22:58:25 +00:00
[fix] Warehouse not mandatory for Purchase Invoice or a Sales Invoice without Update Stock
This commit is contained in:
@@ -67,6 +67,9 @@ def validate_returned_items(doc):
|
||||
|
||||
already_returned_items = get_already_returned_items(doc)
|
||||
|
||||
# ( not mandatory when it is Purchase Invoice or a Sales Invoice without Update Stock )
|
||||
warehouse_mandatory = not (doc.doctype=="Purchase Invoice" or (doc.doctype=="Sales Invoice" and not doc.update_stock))
|
||||
|
||||
items_returned = False
|
||||
for d in doc.get("items"):
|
||||
if flt(d.qty) < 0:
|
||||
@@ -96,8 +99,8 @@ def validate_returned_items(doc):
|
||||
if s not in ref_serial_nos:
|
||||
frappe.throw(_("Row # {0}: Serial No {1} does not match with {2} {3}")
|
||||
.format(d.idx, s, doc.doctype, doc.return_against))
|
||||
|
||||
if doc.doctype != "Purchase Invoice" and not d.get("warehouse"):
|
||||
|
||||
if warehouse_mandatory and not d.get("warehouse"):
|
||||
frappe.throw(_("Warehouse is mandatory"))
|
||||
|
||||
items_returned = True
|
||||
|
||||
Reference in New Issue
Block a user