frappe / erpnext

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

Stock Entry: Transferring stock balance, but not discounted Batch No !! #38453

Open hassan-youssef opened 11 months ago

hassan-youssef commented 11 months ago

Information about bug

Stock Entry done Send to Subcontractor It does not have Batch No and these items have patches There is a difference between the Stock balance and the Batch No balance I want to cancel it because it has a problem with the Batch No and it does not want to be cleared Screenshot from 2023-11-30 11-14-44

Module

stock

Version

ERPNext: v15.4.0 (version-15)

Frappe Framework: v15.3.0 (version-15)

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

File "apps/frappe/frappe/app.py", line 110, in application
    response = frappe.api.handle(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
           ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1689, 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 57, in cancel
    doc.cancel()
  File "apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py", line 180, in cancel
    self._cancel()
  File "apps/frappe/frappe/model/document.py", line 1024, in _cancel
    return self.save()
           ^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 334, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 386, in _save
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1123, in run_post_save_methods
    self.run_method("on_cancel")
  File "apps/frappe/frappe/model/document.py", line 950, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1316, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1298, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 947, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py", line 223, in on_cancel
    self.update_stock_ledger()
  File "apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py", line 1242, in update_stock_ledger
    self.make_sl_entries(sl_entries)
  File "apps/erpnext/erpnext/controllers/stock_controller.py", line 532, 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 85, in make_sl_entries
    sle_doc = make_entry(sle, allow_negative_stock, via_landed_cost_voucher)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/stock/stock_ledger.py", line 212, in make_entry
    sle.submit()
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1038, in submit
    return self._submit()
           ^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1019, in _submit
    return self.save()
           ^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 334, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 356, in _save
    return self.insert()
           ^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 310, in insert
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1121, in run_post_save_methods
    self.run_method("on_submit")
  File "apps/frappe/frappe/model/document.py", line 950, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1316, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1298, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 947, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py", line 132, in on_submit
    self.validate_serial_batch_no_bundle()
  File "apps/erpnext/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py", line 175, in validate_serial_batch_no_bundle
    self.throw_error_message(f"Serial No / Batch No are mandatory for Item {self.item_code}")
  File "apps/erpnext/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py", line 181, in throw_error_message
    frappe.throw(_(message), exception)
  File "apps/frappe/frappe/__init__.py", line 577, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 549, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 500, in _raise_exception
    raise exc
frappe.exceptions.ValidationError: Serial No / Batch No are mandatory for Item 10201035012260
albertfns commented 11 months ago

I have the same problem

rohitwaghchaure commented 11 months ago

@hassan-youssef When you have transferred the materials to the supplier, have you not set the batches? if yes then system should throw the error while submitting the stock entry. Have you done any customization on the stock entry?

hassan-youssef commented 11 months ago

@rohitwaghchaure Any customization on the stock entry? NO