fix: 'NoneType' object has no attribute 'has_serial_no'

This commit is contained in:
Rohit Waghchaure
2024-09-30 12:05:17 +05:30
parent a594c05296
commit 28f9fd2507
2 changed files with 19 additions and 0 deletions

View File

@@ -64,6 +64,18 @@ class StockController(AccountsController):
self.validate_internal_transfer()
self.validate_putaway_capacity()
def validate_items_exist(self):
if not self.get("items"):
return
items = [d.item_code for d in self.get("items")]
exists_items = frappe.get_all("Item", filters={"name": ("in", items)}, pluck="name")
non_exists_items = set(items) - set(exists_items)
if non_exists_items:
frappe.throw(_("Items {0} do not exist in the Item master.").format(", ".join(non_exists_items)))
def validate_duplicate_serial_and_batch_bundle(self, table_name):
if not self.get(table_name):
return