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

fix: not able to cancel DN #44108

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

rohitwaghchaure
Copy link
Collaborator

Issue

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 114, 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 1781, 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/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1053, in cancel
    return self._cancel()
           ^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1036, in _cancel
    return self.save()
           ^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 337, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 390, in _save
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1133, in run_post_save_methods
    self.run_method("on_cancel")
  File "apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1304, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 959, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/stock/doctype/delivery_note/delivery_note.py", line 478, in on_cancel
    self.update_stock_ledger()
  File "apps/erpnext/erpnext/controllers/selling_controller.py", line 554, in update_stock_ledger
    self.make_sl_entries(sl_entries)
  File "apps/erpnext/erpnext/controllers/stock_controller.py", line 904, 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 97, 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 226, 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 1048, in submit
    return self._submit()
           ^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1031, in _submit
    return self.save()
           ^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 337, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 359, in _save
    return self.insert()
           ^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 315, in insert
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1131, in run_post_save_methods
    self.run_method("on_submit")
  File "apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1304, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 959, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py", line 184, in on_submit
    SerialBatchBundle(
  File "apps/erpnext/erpnext/stock/serial_batch_bundle.py", line 27, in __init__
    self.post_process()
  File "apps/erpnext/erpnext/stock/serial_batch_bundle.py", line 292, in post_process
    self.submit_serial_and_batch_bundle()
  File "apps/erpnext/erpnext/stock/serial_batch_bundle.py", line 329, in submit_serial_and_batch_bundle
    self.validate_actual_qty(doc)
  File "apps/erpnext/erpnext/stock/serial_batch_bundle.py", line 133, in validate_actual_qty
    frappe.throw(_(msg), title=_("Incorrect Type of Transaction"))
  File "apps/frappe/frappe/__init__.py", line 658, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 623, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 574, in _raise_exception
    raise exc
frappe.exceptions.ValidationError: The type of transaction of Serial and Batch Bundle SABB-00002096 is Outward but as per the Actual Qty 1.0 for the item PP055A-000 in the Delivery Note DN-ON2425-1834 the type of transaction should be Inward

@github-actions github-actions bot added needs-tests This PR needs automated unit-tests. stock labels Nov 12, 2024
@rohitwaghchaure rohitwaghchaure added backport version-15-hotfix and removed needs-tests This PR needs automated unit-tests. labels Nov 12, 2024
@rohitwaghchaure rohitwaghchaure merged commit e888271 into frappe:develop Nov 12, 2024
14 checks passed
mergify bot pushed a commit that referenced this pull request Nov 12, 2024
(cherry picked from commit e888271)
rohitwaghchaure added a commit that referenced this pull request Nov 12, 2024
fix: not able to cancel DN (#44108)

(cherry picked from commit e888271)

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
frappe-pr-bot pushed a commit that referenced this pull request Nov 13, 2024
# [15.42.0](v15.41.2...v15.42.0) (2024-11-13)

### Bug Fixes

* add default height to POS item card selector (backport [#44071](#44071)) ([#44075](#44075)) ([65ec7c5](65ec7c5))
* add field conversion_factor when include_uom is settled ([#43701](#43701)) ([f387a8f](f387a8f))
* better gls for purchases with tax witholding ([#42743](#42743)) ([705a26a](705a26a))
* bind this object explicitly on callback event function ([3423d3c](3423d3c))
* calculate percentage received and delivered considering over-receipt and over-delivery (backport [#43870](#43870)) ([#44030](#44030)) ([5958d0c](5958d0c))
* Cannot read properties of undefined (reading 'work_order_closed') (backport [#44117](#44117)) ([#44122](#44122)) ([c1983a4](c1983a4))
* consider service item cost in the RM cost of the BOM (backport [#43962](#43962)) ([#44111](#44111)) ([6e83fec](6e83fec))
* Drop Shipping address based on customer shopping address ([8af005c](8af005c))
* duplicate items and outdated item price in POS (backport [#42978](#42978)) ([#44038](#44038)) ([4cde77d](4cde77d))
* exception on register reports when filtered on cost center ([be07421](be07421))
* improved the conditions for determining voucher subtypes ([58ca4a2](58ca4a2))
* incorrect produced qty in Production Plan Summary (backport [#44112](#44112)) ([#44113](#44113)) ([bce7acf](bce7acf))
* item mapping from modal to batch form ([#44090](#44090)) ([9ac54f6](9ac54f6))
* item not set in the batch quick entry form (backport [#44028](#44028)) ([#44031](#44031)) ([6dcd015](6dcd015))
* Negative stock validation against inventory dimension (backport [#43834](#43834)) ([#43846](#43846)) ([b314f38](b314f38))
* NoneType while updating ordered_qty in SO for removed items ([978a007](978a007))
* not able to cancel DN (backport [#44108](#44108)) ([#44109](#44109)) ([290bdde](290bdde))
* not able to reconcile expired batches ([#44012](#44012)) ([4ba07a4](4ba07a4))
* patch ([107d53b](107d53b))
* populate payment schedule from payment terms (backport [#44082](#44082)) ([#44083](#44083)) ([363f151](363f151))
* purchase receipt creation from SCR ([#44095](#44095)) ([e3d7468](e3d7468))
* slow reposting due to SABB update ([3e29ae8](3e29ae8))
* sort by ascending to get the first period closing voucher (backport [#44029](#44029)) ([#44035](#44035)) ([56f25ae](56f25ae))
* task path (backport [#44073](#44073)) ([#44078](#44078)) ([34b5639](34b5639))
* tyeerror while saving pick list ([7d09832](7d09832))
* update payment amount for partial pos return ([61559be](61559be))
* update per_billed value in Purchase Receipt while creating Debit Note ([#43977](#43977)) ([a833dd6](a833dd6))
* when company is created with other company template Chart of Account  the Create Taxe Template failed ([#42755](#42755)) ([e6894b9](e6894b9))

### Features

* Add item group filtering for search results ([2754793](2754793))
* add template taxe for charts of account France - Plan Comptable General avec code ([#42757](#42757)) ([865786e](865786e))
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant