Tuesday, May 21, 2024
4 changes · saas-17.2
Resolved issues and error corrections
This fixes cases where taxes included in a price were recalculated incorrectly after a fiscal position changed one tax to another. Businesses should see more accurate invoice and transaction totals when layered, price-included taxes affect each other.
Original PR description
Suppose: t1: 25% price-included, include_base_amount tax t2: 12.5% price-included, include_base_amount tax t3: 20.0% price-included, include_base_amount tax Apply t1 & t3 on 300: 300 / 1.25 / 1.2 =…
Suppose: t1: 25% price-included, include_base_amount tax t2: 12.5% price-included, include_base_amount tax t3: 20.0% price-included, include_base_amount tax Apply t1 & t3 on 300: 300 / 1.25 / 1.2 = 200 (total_excluded) 300 - 200 = 100 (tax_amount) Apply the fiscal position mapping t1 to t2. The price_unit is now computed from the total excluded (200) using t2 & t3: Currently, you get: 200 + (200 * 0.125) + (200 * 0.20) = 200 + 25 + 40 = 265 Expected: 200 * 1.125 * 1.20 = 270 In this version, the reverse computation doesn't work well because we only manage it during the evaluation of the prepared taxes computation. At this point, it's already too late because some dependencies between taxes (implied by include_base_amount) are missing with reverse=True. This commit replaces the 'reverse' flag by 'special_mode' because, for another purpose later, we will need such kind of similar computation but with a different purpose. 'special_mode' has 3 possible values: - `false`: That's the normal behavior of the taxes computation. - `total_excluded`: Similar behavior as the `reverse` flag. In this mode, you are able to retrieve the whole taxes computation by giving the total tax excluded amount as parameter. Using our example, giving 200 with special_mode = 'total_excluded' will give you: t1 = 60 t2 = 40 total_excluded = 200 total_included = 300 - `total_included`: Quite similar as `total_excluded` except you give the total tax included amount as parameter. Using our example, giving 300 with special_mode = 'total_excluded' will give you: t1 = 60 t2 = 40 total_excluded = 200 total_included = 300 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
This fix prevents Odoo's chatter from crashing when activities are open in more than one browser tab. It improves reliability for users who work across multiple tabs by ensuring activity data is shared safely between them.
Original PR description
Before this commit, when opening a chatter with some activities with 2 or more tabs, the following crash occurs: ``` TypeError: recordFullProxy._fieldsValue.get is not a function ``` This happens…
Before this commit, when opening a chatter with some activities with 2 or more tabs, the following crash occurs: ``` TypeError: recordFullProxy._fieldsValue.get is not a function ``` This happens because activities are shared between tabs, and the translation from structured records to data was leaking internal code `_fieldsValue`, which is used to map values of records that model Chatter data such as actvities. Because `_fieldsValue` is a map and communication between tabs is made through `BroadcastChannel`, data are JSON.stringified and it is expected that reinsert of activity data works. Maps like `_fieldsValue` were leaked, which turned the Map into an object, and since restore activity record in other tabs had an object for `_fieldsValue` instead of expected `Map`, it crashed. This commit fixes the issue by not exposing `_fieldsValues` in the `toData()`, which is used by `BroadcastChannel` use of crosstab sync of activities. Also `toData()` had typos with relational fields which could also result in errors. These are also fixed in this commit.
The inventory relocation wizard now completes correctly when users move product quantities to a new location. This prevents a traceback during the confirm step, reducing disruption for warehouse and inventory teams.
Original PR description
Steps to reproduce: > Inventory App > Reporting > Locations > Select Product > Relocate > Select new location > Confirm > Traceback Bug: since commit [1] it's not possible to execute server actions directly Fix: the server action was only used to set a static context key skipped that step and directly call action_view_quants from quants model opw-3900154 [1]:https://github.com/odoo/odoo/commit/f49e97e9ad41c1c5e7123bad9c429a9af2732b73
Creating a new product with a barcode could fail when barcode lookup was enabled, preventing users from saving the product. This fix corrects the lookup logic so product creation with barcodes works reliably.
Original PR description
When the user creates a new product with barcode and tries to save it, a traceback will appear. Steps to reproduce the error: - Install "product_barcodelookup" module - Add the API key for barcode…
When the user creates a new product with barcode and tries to save it,
a traceback will appear.
Steps to reproduce the error:
- Install "product_barcodelookup" module
- Add the API key for barcode lookup in settings
- Create new product > add barcode(ex. 817882025607) > Save
Traceback:
```
AttributeError: 'uom.uom' object has no attribute '_get_weight_uom_id_from_ir_config_parameter'
File "odoo/http.py", line 2253, in __call__
response = request._serve_db()
File "odoo/http.py", line 1829, in _serve_db
return self._transactioning(_serve_ir_http, readonly=ro)
File "odoo/http.py", line 1849, in _transactioning
return service_model.retrying(func, env=self.env)
File "odoo/service/model.py", line 134, in retrying
result = func()
File "odoo/http.py", line 1827, in _serve_ir_http
return self._serve_ir_http(rule, args)
File "odoo/http.py", line 1834, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "odoo/http.py", line 2059, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "odoo/addons/base/models/ir_http.py", line 220, in _dispatch
result = endpoint(**request.params)
File "odoo/http.py", line 740, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "addons/web/controllers/dataset.py", line 38, in call_kw
return self._call_kw(model, method, args, kwargs)
File "addons/web/controllers/dataset.py", line 34, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "odoo/api.py", line 458, in call_kw
result = getattr(recs, name)(*args, **kwargs)
File "addons/web/models/models.py", line 1004, in onchange
record._apply_onchange_methods(field_name, result)
File "odoo/models.py", line 6879, in _apply_onchange_methods
res = method(self)
File "home/odoo/src/enterprise/saas-17.2/product_barcodelookup/models/product_template.py", line 17, in _onchange_barcode
product._update_product_by_barcodelookup(product, product.barcode)
File "home/odoo/src/enterprise/saas-17.2/product_barcodelookup/models/product_template.py", line 55, in _update_product_by_barcodelookup
to_unit=self.env['uom.uom']._get_weight_uom_id_from_ir_config_parameter(),
```
https://github.com/odoo/enterprise/blob/058a2b63d3272d6b7fd52afba7951c56494b68f5/product_barcodelookup/models/product_template.py#L55 Here, "uom.uom" model has no _get_weight_uom_id_from_ir_config_parameter method.
so It will lead to the above traceback.
sentry-5373607708