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: don't get zero value entries for exchange rate calculation #34475

Merged
merged 2 commits into from
Mar 28, 2023

Conversation

dj12djdjs
Copy link
Collaborator

@dj12djdjs dj12djdjs commented Mar 16, 2023

App Versions

{
	"erpnext": "14.0.0-dev",
	"frappe": "15.0.0-dev"
}

Route

Form/Exchange Rate Revaluation/new-exchange-rate-revaluation-1

Trackeback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 56, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 53, in handle
    return _RESTAPIHandler(call, doctype, name).get_response()
  File "apps/frappe/frappe/api.py", line 69, in get_response
    return self.handle_method()
  File "apps/frappe/frappe/api.py", line 79, in handle_method
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 48, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 86, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1589, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/handler.py", line 307, in run_doc_method
    response = doc.run_method(method)
  File "apps/frappe/frappe/model/document.py", line 922, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1276, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1258, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 919, in fn
    return method_object(*args, **kwargs)
  File "apps/frappe/frappe/utils/typing_validations.py", line 33, in wrapper
    return func(*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'

Request Data

{
	"type": "POST",
	"args": {
		"docs": "{\"docstatus\":0,\"doctype\":\"Exchange Rate Revaluation\",\"name\":\"new-exchange-rate-revaluation-1\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"ds@partsupinc.com\",\"posting_date\":\"2023-03-16\",\"company\":\"PPS Premium Part Supply Inc.\",\"accounts\":[{\"docstatus\":0,\"doctype\":\"Exchange Rate Revaluation Account\",\"name\":\"new-exchange-rate-revaluation-account-1\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"ds@partsupinc.com\",\"account_currency\":\"CAD\",\"zero_balance\":0,\"parent\":\"new-exchange-rate-revaluation-1\",\"parentfield\":\"accounts\",\"parenttype\":\"Exchange Rate Revaluation\",\"idx\":1}]}",
		"method": "get_accounts_data"
	},
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/run_doc_method"
}

Response Data

{
	"exception": "TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'"
}

@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label Mar 16, 2023
@codecov
Copy link

codecov bot commented Mar 16, 2023

Codecov Report

Merging #34475 (1e96ffb) into develop (2942cee) will decrease coverage by 0.25%.
The diff coverage is 83.96%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #34475      +/-   ##
===========================================
- Coverage    64.09%   63.84%   -0.25%     
===========================================
  Files          810      810              
  Lines        59372    59495     +123     
===========================================
- Hits         38052    37987      -65     
- Misses       21320    21508     +188     
Impacted Files Coverage Δ
...ement_of_accounts/process_statement_of_accounts.py 0.00% <0.00%> (ø)
...ext/accounts/report/trial_balance/trial_balance.py 0.00% <0.00%> (ø)
erpnext/hooks.py 100.00% <ø> (ø)
...facturing/doctype/bom_update_log/bom_update_log.py 42.60% <0.00%> (-44.12%) ⬇️
...ext/manufacturing/doctype/work_order/work_order.py 80.88% <0.00%> (-0.28%) ⬇️
...stock/doctype/item_alternative/item_alternative.py 0.00% <0.00%> (ø)
erpnext/www/book_appointment/index.py 0.00% <0.00%> (ø)
erpnext/manufacturing/doctype/bom/bom.py 75.15% <33.33%> (-12.94%) ⬇️
erpnext/controllers/website_list_for_contact.py 53.54% <42.85%> (+0.05%) ⬆️
erpnext/utilities/doctype/video/video.py 23.07% <50.00%> (+0.85%) ⬆️
... and 20 more

... and 5 files with indirect coverage changes

@deepeshgarg007 deepeshgarg007 added the backport version-14-hotfix backport to version 14 label Mar 28, 2023
@deepeshgarg007 deepeshgarg007 merged commit 393bc25 into frappe:develop Mar 28, 2023
mergify bot pushed a commit that referenced this pull request Mar 28, 2023
* fix: multiply None by float

* chore: remove debug

(cherry picked from commit 393bc25)
deepeshgarg007 pushed a commit that referenced this pull request Mar 28, 2023
fix: don't get zero value entries for exchange rate calculation (#34475)

* fix: multiply None by float

* chore: remove debug

(cherry picked from commit 393bc25)

Co-authored-by: Devin Slauenwhite <devin.slauenwhite@gmail.com>
frappe-pr-bot pushed a commit that referenced this pull request Mar 28, 2023
# [14.20.0](v14.19.0...v14.20.0) (2023-03-28)

### Bug Fixes

* default pos conversion factor set to 1 ([#34437](#34437)) ([18d813a](18d813a))
* don't get zero value entries for exchange rate calculation ([#34475](#34475)) ([ff24b3e](ff24b3e))
* incorrect `Opening Value` in `Stock Balance` report ([76b782a](76b782a))
* Note username overlapping with note content(CRM) ([096e5ef](096e5ef))
* Party Name in SOA print when viewed from Customer/Supplier master ([#34597](#34597)) ([835edbe](835edbe))
* Percentage billing in Sales Order ([#34606](#34606)) ([477cb12](477cb12))
* recalculate WDV rate after asset repair [v14] ([#34571](#34571)) ([d2ca6f8](d2ca6f8))
* remove unused translation ([#34519](#34519)) ([881e92e](881e92e))
* removing redundant validation ([fd6db41](fd6db41))
* Sales person variance report without item group ([#34552](#34552)) ([90ddc4a](90ddc4a))
* Tax Category not able to set hence it calculating zero tax for item whoes tax template set ([#34525](#34525)) ([a8567b0](a8567b0))
* Time button not working in the job card ([8fed33b](8fed33b))
* translations and UX in alternative item mapping ([#34433](#34433)) ([702d07e](702d07e))
* unset address and contact on trash (backport [#34495](#34495)) ([#34560](#34560)) ([db01bf5](db01bf5))
* zero rm-cost for batch rm item in SCR (backport [#34616](#34616)) ([#34623](#34623)) ([cff35d7](cff35d7))

### Features

* deprecate get_customer_list ([#34563](#34563)) ([67576ad](67576ad))
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 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 needs-tests This PR needs automated unit-tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants