From 12b2a7ef462e7328a1545334f2ae18634bf40b8e Mon Sep 17 00:00:00 2001 From: Lucas Perais Date: Wed, 25 Jan 2023 09:34:18 +0000 Subject: [PATCH] [IMP] web: Record: improving Record and RelationalModel for usability The Record component becomes more and more used, but its API and the flows it can support are both a work in progress. Its specs become a little clearer, we probably want two things: - be able to display some values via Fields widget and interact with them, in particular relational fields. - fetch, display and interact with a proper record in the db. - disconnect it from the use of model in Views (via the hook useModel), because Record's feature are simpler. This commit aims at clarifying at least 2 aspects: - how to pass the values to the record, that is, without reading anything from the db => a `values` props contains server formatted data, it supports changing them via the props - when to reload the data from the db, when not to. => when props did not change, don't reload anything. We expect further improvements on this component, as the feature is still very basic at this point. See 475f8aa for earlier improvement closes odoo/odoo#110122 Signed-off-by: Aaron Bohy (aab) --- .../calendar_common_popover.xml | 2 +- addons/web/static/src/views/record.js | 56 ++++-- .../web/static/src/views/relational_model.js | 10 +- .../views/fields/many2one_field_tests.js | 7 +- addons/web/static/tests/views/record_tests.js | 174 +++++++++++++++++- 5 files changed, 219 insertions(+), 30 deletions(-) diff --git a/addons/web/static/src/views/calendar/calendar_common/calendar_common_popover.xml b/addons/web/static/src/views/calendar/calendar_common/calendar_common_popover.xml index 521422fce03..361a41d9484 100644 --- a/addons/web/static/src/views/calendar/calendar_common/calendar_common_popover.xml +++ b/addons/web/static/src/views/calendar/calendar_common/calendar_common_popover.xml @@ -44,7 +44,7 @@