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: asset validation misfire on debit notes #37108

Merged

Conversation

ruthra-kumar
Copy link
Member

  1. Make Purchase Invoice and Cancel it.
  2. Amend it. Enable Is Return(Debit Note) and save
request.js:457 Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 95, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 47, 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 1622, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/desk/form/save.py", line 28, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 307, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 329, in _save
    return self.insert()
  File "apps/frappe/frappe/model/document.py", line 261, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1053, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 917, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1279, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1261, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 914, in fn
    return method_object(*args, **kwargs)
  File "apps/erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py", line 91, in validate
    super(PurchaseInvoice, self).validate()
  File "apps/erpnext/erpnext/controllers/buying_controller.py", line 45, in validate
    self.validate_asset_return()
  File "apps/erpnext/erpnext/controllers/buying_controller.py", line 170, in validate_asset_return
    frappe.throw(
  File "apps/frappe/frappe/__init__.py", line 534, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 502, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 451, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.ValidationError:  has submitted assets linked to it. You need to cancel the assets to create purchase return.

@github-actions github-actions bot added buying needs-tests This PR needs automated unit-tests. labels Sep 15, 2023
@codecov
Copy link

codecov bot commented Sep 15, 2023

Codecov Report

Merging #37108 (097b989) into develop (2dbdc40) will increase coverage by 0.00%.
Report is 37 commits behind head on develop.
The diff coverage is 69.11%.

@@            Coverage Diff            @@
##           develop   #37108    +/-   ##
=========================================
  Coverage    66.49%   66.50%            
=========================================
  Files          791      793     +2     
  Lines        62315    62435   +120     
=========================================
+ Hits         41436    41520    +84     
- Misses       20879    20915    +36     
Files Changed Coverage
...xt/accounts/doctype/payment_entry/payment_entry.py ø
...xt/accounts/doctype/sales_invoice/sales_invoice.py ø
erpnext/controllers/accounts_controller.py 33.33%
...ctype/unreconcile_payments/unreconcile_payments.py 55.73%
erpnext/accounts/utils.py 97.91%
...ile_payment_entries/unreconcile_payment_entries.py 100.00%
erpnext/controllers/buying_controller.py 100.00%

@ruthra-kumar ruthra-kumar merged commit a093dff into frappe:develop Sep 15, 2023
13 checks passed
@ruthra-kumar ruthra-kumar added the backport version-14-hotfix backport to version 14 label Sep 15, 2023
ruthra-kumar added a commit that referenced this pull request Sep 15, 2023
…-37108

fix: asset validation misfire on debit notes (backport #37108)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport version-14-hotfix backport to version 14 buying needs-tests This PR needs automated unit-tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant