fix: item none not found while making sales invoice using opening invoice creation tool

This commit is contained in:
Rohit Waghchaure
2020-06-14 14:06:12 +05:30
parent 8fcd86cb9e
commit 5b11d18d86

View File

@@ -552,6 +552,8 @@ class SalesInvoice(SellingController):
continue
for d in self.get('items'):
if not d.item_code: continue
is_stock_item = frappe.get_cached_value('Item', d.item_code, 'is_stock_item')
if (d.item_code and is_stock_item ==1 and not d.get(key.lower().replace(' ', '_')) and not self.get(value[1])):
msgprint(_("{0} is mandatory for Item {1}").format(key, d.item_code), raise_exception=1)
@@ -574,14 +576,14 @@ class SalesInvoice(SellingController):
def validate_item_code(self):
for d in self.get('items'):
if not d.item_code:
if not d.item_code and self.is_opening == "No":
msgprint(_("Item Code required at Row No {0}").format(d.idx), raise_exception=True)
def validate_warehouse(self):
super(SalesInvoice, self).validate_warehouse()
for d in self.get_item_list():
if not d.warehouse and frappe.get_cached_value("Item", d.item_code, "is_stock_item"):
if not d.warehouse and d.item_code and frappe.get_cached_value("Item", d.item_code, "is_stock_item"):
frappe.throw(_("Warehouse required for stock Item {0}").format(d.item_code))
def validate_delivery_note(self):