summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields
diff options
context:
space:
mode:
authorDavid Monjoie <dmo@odoo.com>2019-06-05 14:27:32 +0000
committerVincent Schippefilt <vsc@odoo.com>2019-07-30 06:37:23 +0000
commit307db300670e2c9c3cb8cfa11b2e5e63edd8aa69 (patch)
treecb459aeab47df2effc6f806215950b3b37709368 /addons/web/static/src/js/fields
parent321a3699ed634287010c4ab0701bf6f28704c250 (diff)
[FIX] web: add view id in optional fields local storage key
Since the renderer does not know the view id, we moved the local storage key computation up to the basic controller, which makes more sense since the renderer is supposed to be inert. The _processColumns function had to be moved in willStart however, since it now needs the controller to respond to the trigger_up and the controller is not present during the init of the renderer. closes odoo/odoo#34051 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
Diffstat (limited to 'addons/web/static/src/js/fields')
-rw-r--r--addons/web/static/src/js/fields/relational_fields.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js
index 325bb176e61..c0dc8ec65e5 100644
--- a/addons/web/static/src/js/fields/relational_fields.js
+++ b/addons/web/static/src/js/fields/relational_fields.js
@@ -856,6 +856,8 @@ var FieldX2Many = AbstractField.extend({
toggle_column_order: '_onToggleColumnOrder',
activate_next_widget: '_onActiveNextWidget',
navigation_move: '_onNavigationMove',
+ save_optional_fields: '_onSaveOrLoadOptionalFields',
+ load_optional_fields: '_onSaveOrLoadOptionalFields',
}),
// We need to trigger the reset on every changes to be aware of the parent changes
@@ -1388,6 +1390,18 @@ var FieldX2Many = AbstractField.extend({
});
},
/**
+ * Add necessary key parts for the basic controller to compute the local
+ * storage key. The event will be properly handled by the basic controller.
+ *
+ * @param {OdooEvent} ev
+ * @private
+ */
+ _onSaveOrLoadOptionalFields: function (ev) {
+ ev.data.keyParts.relationalField = this.name;
+ ev.data.keyParts.subViewId = this.view.view_id;
+ ev.data.keyParts.subViewType = this.view.type;
+ },
+ /**
* Forces a resequencing of the records.
*
* @private