frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
20.38k stars 7.08k forks source link

Stock entry error with batch and serial bundle #37487

Closed pritambiswal closed 11 months ago

pritambiswal commented 11 months ago

Information about bug

Creating a stock entry with "material transfer" between two warehouses referring to delivery note. when default delivery quantity is changed, it gives an error. error screenshot and console log is attached. It might have something to do with batch and serial bundle. the item used here are batch and serial number relevant.

image

Module

stock

Version

ERPNext v 15

Installation method

FrappeCloud

Relevant log output / Stack trace / Full Error Message.

/api/method/frappe.desk.form.save.savedocs:1 

        Failed to load resource: the server responded with a status of 417 ()
request.js:456  Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 105, in application
    response = frappe.api.handle()
               ^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api.py", line 53, in handle
    return _RESTAPIHandler(call, doctype, name).get_response()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api.py", line 69, in get_response
    return self.handle_method()
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api.py", line 79, in handle_method
    return frappe.handler.handle()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 48, in handle
    data = execute_cmd(cmd)
           ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 86, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1682, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/desk/form/save.py", line 36, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 331, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 353, in _save
    return self.insert()
           ^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 284, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1084, in run_before_save_methods
    self.run_method("before_save")
  File "apps/frappe/frappe/model/document.py", line 947, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1318, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1300, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 944, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py", line 246, in before_save
    self.make_serial_and_batch_bundle_for_outward()
  File "apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py", line 915, in make_serial_and_batch_bundle_for_outward
    ).update_serial_and_batch_entries()
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/stock/serial_batch_bundle.py", line 811, in update_serial_and_batch_entries
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 331, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 372, in _save
    self.validate_update_after_submit()
  File "apps/frappe/frappe/model/document.py", line 869, in validate_update_after_submit
    self._validate_update_after_submit()
  File "apps/frappe/frappe/model/base_document.py", line 1016, in _validate_update_after_submit
    frappe.throw(
  File "apps/frappe/frappe/__init__.py", line 570, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 542, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 491, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.UpdateAfterSubmitError:  Not allowed to change <strong>None</strong> after submission from <strong>3</strong> to <strong>1</strong>

(anonymous) @ request.js:456
/api/method/frappe.desk.form.save.savedocs:1 

        Failed to load resource: the server responded with a status of 417 ()
request.js:456  Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 105, in application
    response = frappe.api.handle()
               ^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api.py", line 53, in handle
    return _RESTAPIHandler(call, doctype, name).get_response()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api.py", line 69, in get_response
    return self.handle_method()
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api.py", line 79, in handle_method
    return frappe.handler.handle()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 48, in handle
    data = execute_cmd(cmd)
           ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 86, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1682, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/desk/form/save.py", line 36, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 331, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 353, in _save
    return self.insert()
           ^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 284, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1084, in run_before_save_methods
    self.run_method("before_save")
  File "apps/frappe/frappe/model/document.py", line 947, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1318, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1300, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 944, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py", line 246, in before_save
    self.make_serial_and_batch_bundle_for_outward()
  File "apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py", line 915, in make_serial_and_batch_bundle_for_outward
    ).update_serial_and_batch_entries()
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/stock/serial_batch_bundle.py", line 811, in update_serial_and_batch_entries
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 331, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 372, in _save
    self.validate_update_after_submit()
  File "apps/frappe/frappe/model/document.py", line 869, in validate_update_after_submit
    self._validate_update_after_submit()
  File "apps/frappe/frappe/model/base_document.py", line 1016, in _validate_update_after_submit
    frappe.throw(
  File "apps/frappe/frappe/__init__.py", line 570, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 542, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 491, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.UpdateAfterSubmitError:  Not allowed to change <strong>None</strong> after submission from <strong>3</strong> to <strong>1</strong>

(anonymous) @ request.js:456
maveezmh commented 11 months ago

batch numbered stock has some serious concerns... even am not able to get proper values for bartch wise items

rohitwaghchaure commented 11 months ago

@pritambiswal

You should create new bundle and not copy from the stock entry

Screenshot 2023-10-13 at 5 11 11 PM

As this is related to customization, I am closing this ticket