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

Mandatory Project Error In Asset Repair Even If Project Is Not Empty #32758

Closed
ihesamyou opened this issue Oct 29, 2022 · 2 comments
Closed

Mandatory Project Error In Asset Repair Even If Project Is Not Empty #32758

ihesamyou opened this issue Oct 29, 2022 · 2 comments
Labels

Comments

@ihesamyou
Copy link
Contributor

Information about bug

When submitting an asset repair with stock_consumption==1 and at least one item in stock_items table, this error prevents form submission even if a project is selected:

asset_repair_bug

The reason for this error is that project is not passed to stock entry items that get's created and submitted when we try to submit asset repair. Accounting Dimension Filter Validations on stock entry submission event throws this error.

To see the error:
1- Create an Accounting Dimension Filter and enter the expense_account of your item to it.
2- In asset repair enter that item in stock_items table with correct warehouse and serial no.
3- Select a project and try to submit the asset repair.

Module

assets

Version

ERPNext v14.4.0

Installation method

No response

Relevant log output / Stack trace / Full Error Message.

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 69, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 55, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 38, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 76, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1457, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/desk/form/save.py", line 22, in savedocs
    doc.submit()
  File "apps/frappe/frappe/model/document.py", line 1018, in submit
    return self._submit()
  File "apps/frappe/frappe/model/document.py", line 1007, in _submit
    return self.save()
  File "apps/frappe/frappe/model/document.py", line 310, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 347, in _save
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1056, in run_before_save_methods
    self.run_method("before_submit")
  File "apps/frappe/frappe/model/document.py", line 941, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1261, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1243, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 938, in fn
    return method_object(*args, **kwargs)
  File "apps/erpnext/erpnext/assets/doctype/asset_repair/asset_repair.py", line 47, in before_submit
    self.decrease_stock_quantity()
  File "apps/erpnext/erpnext/assets/doctype/asset_repair/asset_repair.py", line 147, in decrease_stock_quantity
    stock_entry.submit()
  File "apps/frappe/frappe/model/document.py", line 1018, in submit
    return self._submit()
  File "apps/frappe/frappe/model/document.py", line 1007, in _submit
    return self.save()
  File "apps/frappe/frappe/model/document.py", line 310, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 364, in _save
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1088, in run_post_save_methods
    self.run_method("on_submit")
  File "apps/frappe/frappe/model/document.py", line 941, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1261, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1243, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 938, in fn
    return method_object(*args, **kwargs)
  File "apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py", line 141, in on_submit
    self.make_gl_entries()
  File "apps/erpnext/erpnext/controllers/stock_controller.py", line 71, in make_gl_entries
    make_gl_entries(gl_entries, from_repost=from_repost)
  File "apps/erpnext/erpnext/accounts/general_ledger.py", line 35, in make_gl_entries
    save_entries(gl_map, adv_adj, update_outstanding, from_repost)
  File "apps/erpnext/erpnext/accounts/general_ledger.py", line 223, in save_entries
    make_entry(entry, adv_adj, update_outstanding, from_repost)
  File "apps/erpnext/erpnext/accounts/general_ledger.py", line 234, in make_entry
    gle.submit()
  File "apps/frappe/frappe/model/document.py", line 1018, in submit
    return self._submit()
  File "apps/frappe/frappe/model/document.py", line 1007, in _submit
    return self.save()
  File "apps/frappe/frappe/model/document.py", line 310, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 332, in _save
    return self.insert()
  File "apps/frappe/frappe/model/document.py", line 291, in insert
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1087, in run_post_save_methods
    self.run_method("on_update")
  File "apps/frappe/frappe/model/document.py", line 941, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1261, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1243, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 938, in fn
    return method_object(*args, **kwargs)
  File "apps/erpnext/erpnext/accounts/doctype/gl_entry/gl_entry.py", line 58, in on_update
    self.validate_allowed_dimensions()
  File "apps/erpnext/erpnext/accounts/doctype/gl_entry/gl_entry.py", line 157, in validate_allowed_dimensions
    frappe.throw(
  File "apps/frappe/frappe/__init__.py", line 504, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 479, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 434, in _raise_exception
    raise raise_exception(msg)
erpnext.exceptions.MandatoryAccountDimensionError: <b>Project</b> is mandatory for account <b>98003 - Cost of Sold Items</b>
@ihesamyou ihesamyou added the bug label Oct 29, 2022
ihesamyou added a commit to ihesamyou/erpnext that referenced this issue Oct 29, 2022
@ihesamyou
Copy link
Contributor Author

PR created for this issue.

@deepeshgarg007
Copy link
Member

@ihosseinu Merged the PR, closing the issue

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants