mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-18 17:15:04 +00:00
fix: validate duplicate serial no in DN
This commit is contained in:
@@ -138,6 +138,7 @@ class DeliveryNote(SellingController):
|
||||
self.validate_uom_is_integer("stock_uom", "stock_qty")
|
||||
self.validate_uom_is_integer("uom", "qty")
|
||||
self.validate_with_previous_doc()
|
||||
self.validate_duplicate_serial_nos()
|
||||
|
||||
from erpnext.stock.doctype.packed_item.packed_item import make_packing_list
|
||||
|
||||
@@ -412,6 +413,21 @@ class DeliveryNote(SellingController):
|
||||
pluck="name",
|
||||
)
|
||||
|
||||
def validate_duplicate_serial_nos(self):
|
||||
serial_nos = []
|
||||
for item in self.items:
|
||||
if not item.serial_no:
|
||||
continue
|
||||
|
||||
for serial_no in item.serial_no.split("\n"):
|
||||
if serial_no in serial_nos:
|
||||
frappe.throw(
|
||||
_("Row #{0}: Serial No {1} is already selected.").format(item.idx, serial_no),
|
||||
title=_("Duplicate Serial No"),
|
||||
)
|
||||
else:
|
||||
serial_nos.append(serial_no)
|
||||
|
||||
|
||||
def update_billed_amount_based_on_so(so_detail, update_modified=True):
|
||||
from frappe.query_builder.functions import Sum
|
||||
|
||||
Reference in New Issue
Block a user