diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 7b31d2fdf2..90a33d3617 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -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