A wired error occur when we submit delivery note

Hi

We got a wired error that we don’t know how to fix.
We are trying to submit a Delivery Note with some items which has been manufactured several days ago.
Please see the error snapshot.
image
MAT-STE-2022-00077 is the ID of that manufactured transaction.
in chrome console , we see error message

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 68, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 55, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 31, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 68, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1213, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/desk/form/save.py", line 19, in savedocs
    doc.submit()
  File "apps/frappe/frappe/model/document.py", line 943, in submit
    return self._submit()
  File "apps/frappe/frappe/model/document.py", line 932, in _submit
    return self.save()
  File "apps/frappe/frappe/model/document.py", line 287, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 341, in _save
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1011, in run_post_save_methods
    self.run_method("on_submit")
  File "apps/frappe/frappe/model/document.py", line 873, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1165, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1148, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 870, in fn
    return method_object(*args, **kwargs)
  File "apps/erpnext/erpnext/stock/doctype/delivery_note/delivery_note.py", line 246, in on_submit
    self.update_stock_ledger()
  File "apps/erpnext/erpnext/controllers/selling_controller.py", line 493, in update_stock_ledger
    self.make_sl_entries(sl_entries)
  File "apps/erpnext/erpnext/controllers/stock_controller.py", line 372, in make_sl_entries
    make_sl_entries(sl_entries, allow_negative_stock, via_landed_cost_voucher)
  File "apps/erpnext/erpnext/stock/stock_ledger.py", line 54, in make_sl_entries
    validate_serial_no(sle)
  File "apps/erpnext/erpnext/stock/stock_ledger.py", line 157, in validate_serial_no
    frappe.throw(_(msg), title=_(title), exc=SerialNoExistsInFutureTransaction)
  File "apps/frappe/frappe/__init__.py", line 444, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable, wide=wide, as_list=as_list)
  File "apps/frappe/frappe/__init__.py", line 423, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 378, in _raise_exception
    raise raise_exception(msg)
erpnext.stock.stock_ledger.SerialNoExistsInFutureTransaction: The serial no <b>020186042213100001</b> has been used in the future transactions so you need to cancel them first.
				The list of the transactions are as below.<br><br><ul><li><b>Stock Entry</b> <b><a href="https://erpnext.net-swift.com/app/stock-entry/MAT-STE-2022-00077">MAT-STE-2022-00077</a></b></li></ul>

frappe version 13.25.0
erpnext version 13.25.1
Thanks for the help

try to change delivery note posting date to Today, save, then submit again

seems your process flow as below caused the problem,

  1. submit sales order
  2. handle work order
  3. before stock entry ->Manufacture, created and saved draft delivery note
  4. submitted stock entry ->Manufature
  5. submit the draft delivery note, system detected future stock entry as delivery note created before stock entry->Manufacture.