Commit Graph
5 Commits
Author SHA1 Message Date
Mathieu Duckerts-Antoine 4aa5f00dc9 [IMP] web: sample server: support of array_agg
In SampleServer, we make _mockReadGroup support array_agg (at least for
the field id).

closes odoo/odoo#135020

Related: odoo/enterprise#37757
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-09-15 10:48:25 +00:00
Aaron Bohy 2a121a32a2 [REF] *: rename unity_web_search_read into web_search_read
Part-of: odoo/odoo#133617
2023-08-31 09:04:58 +00:00
Aaron Bohy 986c00c1bd [REF] web,*: always use unity_web_search_read
*project,spreadsheet

The unity version of web_search_read will soon replace the older
one, so this commit prepares the work by adapting the remaining
calls to web_search_read s.t. they call unity_web_search_read
instead.

Part-of: odoo/odoo#133617
2023-08-31 09:04:58 +00:00
Aaron Bohy 660cde4298 [FIX] web: SampleServer: properly mock unity_web_search_read
Before this commit, many2one values were still returned as pairs
of id and display_name by unity read, whereas they should be
objects with keys id and display_name.

Part-of: odoo/odoo#133617
2023-08-31 09:04:58 +00:00
8723f020c3 [REF] web: new RelationalModel
Before this commit, we had several implementations of a relational
model. The form view used the BasicRelationalModel, which was a
wrapper around the BasicModel. The list view used the
RelationalModel (a simpler version that didn't support complex
usecases of x2many fields). The kanban view used the KanbanModel,
an extension of RelationalModel.

This commit removes all these, and replaces them by a single model.
It is called RelationalModel, and as a similar structure as its
predecessor (with datapoints). It now handles tricky x2many usecases
of the form view though.

This commit also comes with several important changes:
 1) The new model is based on unity reads [1]. This means that all
 data required by the view is fetched at once, and datapoints are
 created with their data (whereas before, they were responsible to
 fetch their data). There's an exception for special data: they are
 no longer handler by the model. A hook "useSpecialData" has been
 created, and it allows fields (components) to fetch additional
 data they require.

 2) The new model uses onchange2 [2]. With onchange2, we send and
 receive a diff, instead of the whole state of the record. Morever,
 onchange2 uses unity, which means that returned commands for x2manys
 (e.g. command 4, LINK) contain the values of the corresponding
 records, so we don't need to fetch them in a separate call
 afterwards.

 3) The new model no longer triggers deep renderings (render(true)).
 It is instead based on fine-grained reactivity (i.e. only what
 depends on what has changed is re-rendered). We introduced a hook
 "observeRecord" which allows a component to subscribe itself to
 some keys in a record datapoint, and register a callback to
 execute when those keys change (e.g. to fetch data).

[1] odoo/odoo@7d2baaa0c7
[2] odoo/odoo@f5e6494da3

Task~3179751

Part-of: odoo/odoo#114024
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: FrancoisGe <fge@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Co-authored-by: Pierre Rousseau <pro@odoo.com>
2023-07-24 20:17:50 +02:00