[FIX] models.py: tree instead of list

Oversight in odoo/odoo#100376

The web client sends `list` rather than `tree` when requesting
views.

However, once they went through `get_views`, they are converted back
to `tree`.
https://github.com/odoo/odoo/blob/master/odoo/models.py#L1653

So, here, we should check against `tree`, not `list`.

Could be seen in Lunch > Manager > Today's Order.
With the `id` field missing, an error is raised
```
Uncaught (in promise) Error: The following error occurred in onWillStart: "field is undefined"
```

closes odoo/odoo#100474

Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
This commit is contained in:
Denis Ledoux
2022-09-19 12:23:15 +02:00
parent e6536f878e
commit abbf73a6e2
+1 -1
View File
@@ -1848,7 +1848,7 @@ class BaseModel(metaclass=MetaModel):
:return: dict holding the models and field required by the web client given the view type.
:rtype: list
"""
if view_type in ('kanban', 'list', 'form'):
if view_type in ('kanban', 'tree', 'form'):
for model_fields in models.values():
model_fields.update({'id', self.CONCURRENCY_CHECK_FIELD})
elif view_type == 'search':