From 307db300670e2c9c3cb8cfa11b2e5e63edd8aa69 Mon Sep 17 00:00:00 2001 From: David Monjoie Date: Wed, 5 Jun 2019 14:27:32 +0000 Subject: [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 --- addons/web/static/src/js/fields/relational_fields.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'addons/web/static/src/js/fields/relational_fields.js') 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 @@ -1387,6 +1389,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. * -- cgit v1.2.3