fix: validate duplicate serial no on submit in DN (#37243)
This commit is contained in:
@@ -138,7 +138,9 @@ 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()
|
||||
|
||||
if self.get("_action") == "submit":
|
||||
self.validate_duplicate_serial_nos()
|
||||
|
||||
from erpnext.stock.doctype.packed_item.packed_item import make_packing_list
|
||||
|
||||
|
||||
@@ -1234,14 +1234,10 @@ class TestDeliveryNote(FrappeTestCase):
|
||||
)
|
||||
dn.items[0].serial_no = "\n".join(serial_nos[:2])
|
||||
dn.append("items", dn.items[0].as_dict())
|
||||
dn.save()
|
||||
|
||||
# Test - 1: ValidationError should be raised
|
||||
self.assertRaises(frappe.ValidationError, dn.save)
|
||||
|
||||
# Step - 4: Submit Delivery Note with unique Serial Nos
|
||||
dn.items[1].serial_no = "\n".join(serial_nos[2:])
|
||||
dn.save()
|
||||
dn.submit()
|
||||
self.assertRaises(frappe.ValidationError, dn.submit)
|
||||
|
||||
def tearDown(self):
|
||||
frappe.db.rollback()
|
||||
|
||||
Reference in New Issue
Block a user