odoo/enterprise#39973
Created by Archana Vaghasiya (arva)
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/template: Contact runbot team for help in case of failure.
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- ci/l10n: (runtime 1518s)
- label
- odoo-dev:16.0-opw-4079706938-onchange-form-amount-currency-arva
- head
- fe0aec6b61f366a6967a9f38d369c4ae8f71d9d2
- merged
- 2 years ago by Accounting, Quentin De Paoli (qdp)
odoo/enterprise | |
---|---|
16.0 | #39973 |
saas-16.1 | #40540 |
saas-16.2 | #40549 |
17.0 | |
saas-17.4 | |
18.0 | |
saas-18.1 | |
saas-18.2 | |
saas-18.3 | |
master | #40753 |
[FIX] account_accountant: prevent to calculate none and float type value
TypeError unsupported operand type(s) for *: 'NoneType' and 'int' is generated because the None
balance value is calculated with float type when currency_id is not provided.
step to reproduce:
1 . Install the accounting
module
2 . Active multiple currencies from configuration > currencies.
3 . Create one invoice and add items in the invoice lines and confirm it.
4 . Prepare a Bank Reconciliation in which add the foreign currency and fill in
the details of the invoice.
5 . And then open the previously created Bank Reconciliation and remove the
foreign currency
from its manual operation page.
At that time traceback occurs.
Traceback on sentry :
TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'
File "odoo/http.py", line 2109, in __call__
response = request._serve_db()
File "odoo/http.py", line 1692, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "odoo/service/model.py", line 134, in retrying
result = func()
File "odoo/http.py", line 1719, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "odoo/http.py", line 1916, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "odoo/addons/base/models/ir_http.py", line 154, in _dispatch
result = endpoint(**request.params)
File "odoo/http.py", line 709, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "addons/web/controllers/dataset.py", line 28, in call_kw
return self._call_kw(model, method, args, kwargs)
File "addons/web/controllers/dataset.py", line 24, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "odoo/api.py", line 461, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "odoo/api.py", line 448, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "home/odoo/src/enterprise/saas-16.2/account_accountant/models/bank_rec_widget.py", line 933, in onchange
return super(BankRecWidget, self.with_context(recursive_onchanges=False)).onchange(values, field_name, field_onchange)
File "odoo/models.py", line 6521, in onchange
record._onchange_eval(name, field_onchange[name], result)
File "odoo/models.py", line 6232, in _onchange_eval
method_res = method(self)
File "home/odoo/src/enterprise/saas-16.2/account_accountant/models/bank_rec_widget.py", line 672, in _onchange_todo_command
self._process_todo_command(command_split[0], command_split[1:])
File "home/odoo/src/enterprise/saas-16.2/account_accountant_batch_payment/models/bank_rec_widget.py", line 131, in _process_todo_command
super()._process_todo_command(command_name, command_args)
File "home/odoo/src/enterprise/saas-16.2/account_accountant/models/bank_rec_widget.py", line 627, in _process_todo_command
self._action_trigger_matching_rules()
File "home/odoo/src/enterprise/saas-16.2/sale_account_accountant/models/bank_rec_widget.py", line 15, in _action_trigger_matching_rules
matching = super()._action_trigger_matching_rules()
File "home/odoo/src/enterprise/saas-16.2/account_accountant/models/bank_rec_widget.py", line 1526, in _action_trigger_matching_rules
self._action_select_reconcile_model(reco_model)
File "home/odoo/src/enterprise/saas-16.2/account_accountant/models/bank_rec_widget.py", line 1602, in _action_select_reconcile_model
self.line_ids = [
File "home/odoo/src/enterprise/saas-16.2/account_accountant/models/bank_rec_widget.py", line 1603, in <listcomp>
Command.create(self._lines_widget_prepare_reco_model_write_off_vals(reco_model, x))
File "home/odoo/src/enterprise/saas-16.2/account_accountant/models/bank_rec_widget.py", line 1464, in _lines_widget_prepare_reco_model_write_off_vals
._prepare_counterpart_amounts_using_st_line_rate(self.transaction_currency_id, None, write_off_vals['amount_currency'])['balance']
File "addons/account/models/account_bank_statement_line.py", line 530, in _prepare_counterpart_amounts_using_st_line_rate
journ_amount_currency = journal_currency.round(balance * rate_comp2journal_curr)
In this commit, if form_currency_id
is empty, it will accept form_amount_currency
as form_balance
.
sentry - 4079706938