odoo/odoo#122825
Created by POS IoT, Parth Solanki (paso)
Merged
at dc64983d058861f5c4333d008276c073c96eef01
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.
- label
- odoo-dev:15.0-sentry-4208813474-fix-precision-rounding-pricelist-paso
- head
- ee82a584409269e9a2ac5b442458decaf3805751
- merged
- 2 years ago by POS IoT, Parth Solanki (paso)
odoo/odoo | |
---|---|
15.0 | #122825 |
saas-15.2 | #123334 |
16.0 | #123347 |
saas-16.1 | #123475 |
saas-16.2 | #123492 |
saas-16.3 | #123519 |
17.0 | |
18.0 | |
saas-18.1 | |
saas-18.2 | |
saas-18.3 | |
master | #123539 |
[FIX] product: fix negative rounding method for pricelist
If applied, this commit will solve the issue of the rounding method AssertionError while configuring any negative value in pricelists.
Steps to produce:
- Open Sale > Products > Pricelists > Create/Open any Pricelist.
- Add a new line in Pricelist Rules.
- Set computation as 'Formula'.
- In the Rounding Method field configure any negative value i.e. -1.56.
- Error will be raised.
Fix this issue by preventing the user from entering the negative value in Rounding Method.
Sentry-4208813474
See Traceback:
KeyError: <NewId 0x7f6a85db0ac0>
File "odoo/api.py", line 958, in get
cache_value = field_cache[record._ids[0]]
CacheMiss: 'product.pricelist.item(<NewId 0x7f6a85db0ac0>,).rule_tip'
File "odoo/fields.py", line 1158, in __get__
value = env.cache.get(record, self)
File "odoo/api.py", line 965, in get
raise CacheMiss(record, field)
AssertionError: precision_rounding must be positive, got -0.04
File "odoo/http.py", line 2115, in __call__
response = request._serve_db()
File "odoo/http.py", line 1698, 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 1725, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "odoo/http.py", line 1922, 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 715, 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 "odoo/models.py", line 6540, in onchange
todo = [
File "odoo/models.py", line 6543, in <listcomp>
if name not in done and snapshot0.has_changed(name)
File "odoo/models.py", line 6326, in has_changed
return self[name] != record[name]
File "odoo/models.py", line 5932, in __getitem__
return self._fields[key].__get__(self, type(self))
File "odoo/fields.py", line 1208, in __get__
self.compute_value(recs)
File "odoo/fields.py", line 1367, in compute_value
records._compute_field_value(self)
File "odoo/models.py", line 4302, in _compute_field_value
fields.determine(field.compute, self)
File "odoo/fields.py", line 99, in determine
return needle(*args)
File "addons/product/models/product_pricelist_item.py", line 174, in _compute_rule_tip
discounted_price = tools.float_round(discounted_price, precision_rounding=item.price_round)
File "odoo/tools/float_utils.py", line 54, in float_round
rounding_factor = _float_check_precision(precision_digits=precision_digits,
File "odoo/tools/float_utils.py", line 29, in _float_check_precision
assert precision_rounding is None or precision_rounding > 0,\