Browse Source

fix: duplicate items validation for POS Invoice when allow multiple items is disabled (#23896)

* fix: duplicate items validation for POS when allow multiple items in disabled

* fix: variable name change for duplicate item validation

Co-authored-by: pateljannat <jannatpatel@MacBook-Air.local>
develop
Jannat Patel 4 years ago
committed by GitHub
parent
commit
c1187bc1d5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      erpnext/controllers/selling_controller.py

22
erpnext/controllers/selling_controller.py

@ -416,26 +416,26 @@ class SellingController(StockController):
return
for d in self.get('items'):
if self.doctype == "Sales Invoice":
e = [d.item_code, d.description, d.warehouse, d.sales_order or d.delivery_note, d.batch_no or '']
f = [d.item_code, d.description, d.sales_order or d.delivery_note]
if self.doctype in ["POS Invoice","Sales Invoice"]:
stock_items = [d.item_code, d.description, d.warehouse, d.sales_order or d.delivery_note, d.batch_no or '']
non_stock_items = [d.item_code, d.description, d.sales_order or d.delivery_note]
elif self.doctype == "Delivery Note":
e = [d.item_code, d.description, d.warehouse, d.against_sales_order or d.against_sales_invoice, d.batch_no or '']
f = [d.item_code, d.description, d.against_sales_order or d.against_sales_invoice]
stock_items = [d.item_code, d.description, d.warehouse, d.against_sales_order or d.against_sales_invoice, d.batch_no or '']
non_stock_items = [d.item_code, d.description, d.against_sales_order or d.against_sales_invoice]
elif self.doctype in ["Sales Order", "Quotation"]:
e = [d.item_code, d.description, d.warehouse, '']
f = [d.item_code, d.description]
stock_items = [d.item_code, d.description, d.warehouse, '']
non_stock_items = [d.item_code, d.description]
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1:
if e in check_list:
if stock_items in check_list:
frappe.throw(_("Note: Item {0} entered multiple times").format(d.item_code))
else:
check_list.append(e)
check_list.append(stock_items)
else:
if f in chk_dupl_itm:
if non_stock_items in chk_dupl_itm:
frappe.throw(_("Note: Item {0} entered multiple times").format(d.item_code))
else:
chk_dupl_itm.append(f)
chk_dupl_itm.append(non_stock_items)
def validate_target_warehouse(self):
items = self.get("items") + (self.get("packed_items") or [])

Loading…
Cancel
Save