odoo/odoo#145262
Created by fw-bot
Merged
at b389016cd30d20beaeaf76edb22206f1a3c5d581
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 on discord for help.
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- label
- odoo-dev:17.0-15.0-sentry-4593791704-indexerror-in-chile-accounting-reka-QBj5-fw
- head
- d317645368e71062376204ad8debb7890379c790
- merged
- 1 year ago by Accounting, Josse Colpaert (jco)
odoo/odoo | |
---|---|
15.0 | #140862 |
saas-15.2 | #145168 |
16.0 | #145175 |
saas-16.1 | #145188 |
saas-16.2 | #145203 |
saas-16.3 | #145217 |
saas-16.4 | #145234 |
17.0 | #145262 |
saas-17.4 | |
18.0 | |
saas-18.1 | |
saas-18.2 | |
saas-18.3 | |
master | #145278 |
[FW][FIX] l10n_cl: prevent IndexError when creating customer
When the user creates a new customer and enters "." in Identification Number,
a traceback will appear.
Steps to reproduce the error:
- Install "l10n_cl" module
- Switch to Chile Company
- Go to Invoicing > Customers > Create New Customer > Enter Name >
Select 'Chile' in Country > Enter "." in Identification Number > Save
Traceback:
IndexError: string index out of range
File "odoo/http.py", line 2139, in __call__
response = request._serve_db()
File "odoo/http.py", line 1715, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "odoo/service/model.py", line 133, in retrying
result = func()
File "odoo/http.py", line 1742, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "odoo/http.py", line 1943, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "odoo/addons/base/models/ir_http.py", line 191, in _dispatch
result = endpoint(**request.params)
File "odoo/http.py", line 717, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "addons/web/controllers/dataset.py", line 30, in call_kw
return self._call_kw(model, method, args, kwargs)
File "addons/web/controllers/dataset.py", line 26, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "odoo/api.py", line 464, in call_kw
result = _call_kw_model_create(method, model, args, kwargs)
File "odoo/api.py", line 444, in _call_kw_model_create
result = method(recs, *args, **kwargs)
File "<decorator-gen-490>", line 2, in create
File "odoo/api.py", line 414, in _model_create_multi
return create(self, [arg])
File "addons/l10n_cl/models/res_partner.py", line 55, in create
vals['vat'] = self._format_vat_cl(vals)
File "addons/l10n_cl/models/res_partner.py", line 41, in _format_vat_cl
return stdnum.util.get_cc_module('cl', 'vat').format(values['vat']).replace('.', '').replace(
File "stdnum/cl/rut.py", line 90, in format
number[-4:-1] + '-' + number[-1])
code reference:
https://github.com/odoo/odoo/blob/276972f96d2eb1a65686e7319f601ed435b57b88/addons/l10n_cl/models/res_partner.py#L40
Here, when user enters "." in Identification Number
then values['vat'] will be ".",
So when it will try to .format(),
It will lead to above traceback.
sentry-4593791704
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: #140862