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

Error in running Exchange Rate revaluation with no previous items and zero balance account #34889

Closed
aakvatech opened this issue Apr 17, 2023 · 3 comments · Fixed by #36076
Closed
Assignees
Labels

Comments

@aakvatech
Copy link
Contributor

Information about bug

image

When click on 'Get Entries' we get this error.

When changed the code from:
` current_exchange_rate = calculate_exchange_rate_using_last_gle(
company, d.account, d.party_type, d.party
)

to
current_exchange_rate = calculate_exchange_rate_using_last_gle(
company, d.account, d.party_type, d.party
) or 0
`

The value of NoneType is avoided and the process continues

Module

accounts

Version

Frappe Framework: v14.30.0 (HEAD)
ERPNext: v14.20.0 (HEAD)
Frappe HR: v14.2.0 (HEAD)

Installation method

FrappeCloud

Relevant log output / Stack trace / Full Error Message.

` Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 66, 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 45, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 83, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1607, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/handler.py", line 304, in run_doc_method
    response = doc.run_method(method)
  File "apps/frappe/frappe/model/document.py", line 914, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1264, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1246, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 911, in fn
    return method_object(*args, **kwargs)
  File "apps/erpnext/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py", line 96, in get_accounts_data
    accounts_with_new_balance = self.calculate_new_account_balance(
  File "apps/erpnext/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py", line 230, in calculate_new_account_balance
    current_exchange_rate * d.balance_in_account_currency
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'`
`
@aakvatech
Copy link
Contributor Author

This is still happening. It's a matter of putting an or 0 so that it can be resolved.

@aakvatech
Copy link
Contributor Author

aakvatech commented Jul 10, 2023

Tested on:

ERPNext: v14.29.2 (HEAD)
Frappe Framework: v14.40.2 (HEAD)
Frappe HR: v14.5.0 (HEAD)

@ruthra-kumar
Copy link
Member

@aakvatech
Can't replicate this. calculate_exchange_rate_using_last_gle returns None only if the company and account are not provided, which from the screenshot, doesn't look like it. Can you try manually adding that account in the child table?

This is still happening. It's a matter of putting an or 0 so that it can be resolved.

For now, I've added the fix. But, the edge case that caused this typeerror is still not clear.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 5, 2024
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.

2 participants