From 836f9f34e42a41d0a64792ca8c6b49eb2c35320e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 26 Feb 2015 11:40:20 +0530 Subject: [PATCH] warehouse mandatory in sales invoice if update_stock --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index a2bf78c449..676a468aa9 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -59,6 +59,7 @@ class SalesInvoice(SellingController): if cint(self.update_stock): self.validate_item_code() + self.validate_warehouse() self.update_current_stock() self.validate_delivery_note() @@ -350,6 +351,11 @@ class SalesInvoice(SellingController): if not d.item_code: msgprint(_("Item Code required at Row No {0}").format(d.idx), raise_exception=True) + def validate_warehouse(self): + for d in self.get('entries'): + if not d.warehouse: + frappe.throw(_("Warehouse required at Row No {0}").format(d.idx)) + def validate_delivery_note(self): for d in self.get("entries"): if d.delivery_note: