Files
odoo_source/addons/web_editor
Florian Charlier be9f264011 [IMP] web_editor: add filter-in to m2o/m2m snippet widget
Adds basic support to filter possible m2x values based on another
record. This is necessary for the website_appointment snippet
introduced within this bundle (see related ENT PR).

An important need implemented here is to not store a list of valid IDs
in the DOM but fetch them based on data stored by a different widget.

Use case covered:
Model A has a Many2Many relationship with Model B via a `model_b_ids`
field.

A first widget (Wa) on a snippet's options allows to select a record of
Model A. A second widget (Wb) allows to select records of Model B.

```xml
<!--Widget A-->
<we-many2many data-model="model.a" data-m2o-field="name"
 data-fakem2m="true".../>

<!--Widget B-->
<we-many2many data-model="model.a" data-m2o-field="model_b_ids"
 data-filter-in="true" .../>
```

Before this commit, the second widget would only be able to show
all records of Model B linked to any Model A record and matching a
static domain provided as attribute, which is still supported.

This commit allows, after having selected `record_a` in the first
widget, to only populate the second widget with the records of
Model B that are in `record_a.model_b_ids`.

Implementing this is done by
 * Adding `data-filter-in` to Wb's xml attributes (as above)
 * Calling `Wb.setFilterInDomainIds()` when another record is selected
   in Wa.

Task-2574175
odoo/odoo#90748
See odoo/enterprise#23750

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-02-10 10:13:00 +01:00
..
…