[fix] Warehouse not mandatory for Purchase Invoice or a Sales Invoice without Update Stock
This commit is contained in:
parent
9c0983f1b6
commit
ed8d9dadfa
@ -23,5 +23,5 @@ def get_context(context):
|
|||||||
context.top_bar_items = [
|
context.top_bar_items = [
|
||||||
{"label": "User Manual", "url": context.docs_base_url + "/user/manual", "right": 1},
|
{"label": "User Manual", "url": context.docs_base_url + "/user/manual", "right": 1},
|
||||||
{"label": "Videos", "url": context.docs_base_url + "/user/videos", "right": 1},
|
{"label": "Videos", "url": context.docs_base_url + "/user/videos", "right": 1},
|
||||||
{"label": "Developer Docs", "url": context.docs_base_url + "/current", "right": 1}
|
{"label": "API Documentation", "url": context.docs_base_url + "/current", "right": 1}
|
||||||
]
|
]
|
||||||
|
@ -67,6 +67,9 @@ def validate_returned_items(doc):
|
|||||||
|
|
||||||
already_returned_items = get_already_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
|
items_returned = False
|
||||||
for d in doc.get("items"):
|
for d in doc.get("items"):
|
||||||
if flt(d.qty) < 0:
|
if flt(d.qty) < 0:
|
||||||
@ -97,7 +100,7 @@ def validate_returned_items(doc):
|
|||||||
frappe.throw(_("Row # {0}: Serial No {1} does not match with {2} {3}")
|
frappe.throw(_("Row # {0}: Serial No {1} does not match with {2} {3}")
|
||||||
.format(d.idx, s, doc.doctype, doc.return_against))
|
.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"))
|
frappe.throw(_("Warehouse is mandatory"))
|
||||||
|
|
||||||
items_returned = True
|
items_returned = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user