[FIX] point_of_sale: ui stuck when product has grouped tax
To reproduce:
1. Create a grouped tax with multiple taxes. Reorder the tax
items. (Important step.)
2. Assign tax to the product.
3. Open pos loading the product.
4. a. [BUG] If pos config is tax-included -> non-responsive ui.
4. b. [BUG] If pos config is tax-excluded:
Add the product. -> non-responsive ui.
Fix:
With the new reactivity in owl, mutating reactive objects will
trigger rerender. However, computing tax amount of orderline
or product with grouped taxes result to mutation of a reactive
object, triggering an infinite render (render -> compute with
mutation -> will trigger another render -> ...).
The call to sort is mutating the reactive array referred by
`children_tax_ids`. To prevent this infinite render, the solution
is to use a copy of the array when sorting the taxes.
OPW-2816546
closes odoo/odoo#88245
X-original-commit: b273056a12a34fec75d980e8a4a08ebaedad7e9c
Signed-off-by: Masereel Pierre <pim@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
This commit is contained in:
@@ -1718,7 +1718,7 @@ class Orderline extends PosModel {
|
||||
// 1) Flatten the taxes.
|
||||
|
||||
var _collect_taxes = function(taxes, all_taxes){
|
||||
taxes.sort(function (tax1, tax2) {
|
||||
taxes = [...taxes].sort(function (tax1, tax2) {
|
||||
return tax1.sequence - tax2.sequence;
|
||||
});
|
||||
_(taxes).each(function(tax){
|
||||
|
||||
Reference in New Issue
Block a user