Skip to content
Snippets Groups Projects
Commit d8322e64 authored by Alvaro Fuentes's avatar Alvaro Fuentes
Browse files

[FIX] stock_landed_costs: use list not tuple


ae96f0e introduced an issue because the update of the m2m used a `tuple`
instead of a `list`

How to reproduce:

* Apply only the (Python) code changes done in ae96f0e, keeping the same
view (i.e. ignore the changed done to the view in ae96f0e).
* Instead of `n=5000` in the compute set `n=1` (it cannot be reproduced
with 5000 unless we create enough dummy data).
* On a clean v13 db with Landed costs (Accounting + Inventory + Purchase
+ demo data)
* Confirm a Purchase
* Create a Landed cost
* Try to select a transfer

Traceback:
```
...
    return f(self, *args, **kwargs)
  File "/home/odoo/src/odoo/13.0/odoo/sql_db.py", line 250, in execute
    res = self._obj.execute(query, params)
psycopg2.errors.UndefinedFunction: operator does not exist: integer = integer[]
LINE 1: ...FROM "stock_picking" WHERE (("stock_picking"."id" in (ARRAY[...
                                                             ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
```

On the reported issues the traceback occur only for DBs with more than
5000 valid pickings, and for views that use the field
`allowed_pickign_ids`.

opw-2762355

closes odoo/odoo#84479

X-original-commit: ccd37565
Signed-off-by: default avatarChristophe Simonis <chs@odoo.com>
parent 2e7e2525
No related branches found
No related tags found
No related merge requests found
......@@ -97,7 +97,7 @@ class StockLandedCost(models.Model):
n = 5000
cost.allowed_picking_ids = valued_picking_ids_per_company[cost.company_id.id][:n]
for ids_chunk in tools.split_every(n, valued_picking_ids_per_company[cost.company_id.id][n:]):
cost.allowed_picking_ids = tuple((4, id_) for id_ in ids_chunk)
cost.allowed_picking_ids = [(4, id_) for id_ in ids_chunk]
@api.onchange('target_model')
def _onchange_target_model(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment