fix: Incorrect mandatory error message for warehouse

This commit is contained in:
Noah Jacob 2021-08-19 15:27:30 +05:30
parent 2c40b7c206
commit cf8d2d97dd

View File

@ -317,9 +317,6 @@ class StockEntry(StockController):
d.s_warehouse = self.from_warehouse
d.t_warehouse = self.to_warehouse
if not (d.s_warehouse or d.t_warehouse):
frappe.throw(_("Atleast one warehouse is mandatory"))
if self.purpose in source_mandatory and not d.s_warehouse:
if self.from_warehouse:
d.s_warehouse = self.from_warehouse
@ -332,6 +329,7 @@ class StockEntry(StockController):
else:
frappe.throw(_("Target warehouse is mandatory for row {0}").format(d.idx))
if self.purpose == "Manufacture":
if validate_for_manufacture:
if d.is_finished_item or d.is_scrap_item:
@ -346,6 +344,9 @@ class StockEntry(StockController):
if cstr(d.s_warehouse) == cstr(d.t_warehouse) and not self.purpose == "Material Transfer for Manufacture":
frappe.throw(_("Source and target warehouse cannot be same for row {0}").format(d.idx))
if not (d.s_warehouse or d.t_warehouse):
frappe.throw(_("Atleast one warehouse is mandatory"))
def validate_work_order(self):
if self.purpose in ("Manufacture", "Material Transfer for Manufacture", "Material Consumption for Manufacture"):
# check if work order is entered