Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v15 Serial and Batch Bundle - Stock Reconciliation broken for old stock? #38796

Closed
casesolved-co-uk opened this issue Dec 16, 2023 · 0 comments · Fixed by #38754
Closed

v15 Serial and Batch Bundle - Stock Reconciliation broken for old stock? #38796

casesolved-co-uk opened this issue Dec 16, 2023 · 0 comments · Fixed by #38754
Labels

Comments

@casesolved-co-uk
Copy link

Information about bug

  • When creating a Stock Reconciliation to put the stock quantity to zero for old (pre-v15) batched stock, two new Serial and Batch Bundles were created. 1. Outward with negative qty, 2. Inward with positive qty. And no Stock Entry ?
  • When trying to cancel this Stock Reconciliation I got the error below (No Serial Batch Bundle) because it (presumably) tries to create a Cancel SLE from the old existing SLE which does not link to a Serial Batch Bundle
  • The same action worked fine on v14

Relates to:
#34564

@rohitwaghchaure

Module

stock

Version

ERPNext: v15.6.1 (version-15)
Frappe Framework: v15.5.0 (version-15)

Installation method

None

Relevant log output / Stack trace / Full Error Message.

Traceback (most recent call last):
  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 1715, 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_reconciliation/stock_reconciliation.py", line 738, 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_reconciliation/stock_reconciliation.py", line 114, in on_cancel
    self.make_sle_on_cancel()
  File "apps/erpnext/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py", line 630, in make_sle_on_cancel
    self.make_sl_entries(sl_entries, allow_negative_stock=allow_negative_stock)
  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 172, in on_submit
    self.validate_serial_batch_no_bundle()
  File "apps/erpnext/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py", line 215, 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 221, in throw_error_message
    frappe.throw(_(message), exception)
  File "apps/frappe/frappe/__init__.py", line 603, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 575, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 526, in _raise_exception
    raise exc
frappe.exceptions.ValidationError: Serial No / Batch No are mandatory for Item 10010626
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant