From 180f5285286c6bf4753935680fb493d4b5e04a36 Mon Sep 17 00:00:00 2001 From: len-odoo Date: Tue, 30 Oct 2018 10:16:09 +0000 Subject: [FIX] web: reload many2one data if the context has changed When a view is loaded, it checks which fields it has to load. In the case of a many2one, it could be the case that a context key is present in one view and not in the other; if it happens, we should reload the data, as a name_get result could vary. opw 1891295 closes odoo/odoo#28298 --- addons/web/static/src/js/views/basic/basic_view.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'addons/web/static/src/js/views/basic/basic_view.js') diff --git a/addons/web/static/src/js/views/basic/basic_view.js b/addons/web/static/src/js/views/basic/basic_view.js index c76020cacac..cdb1cc05290 100644 --- a/addons/web/static/src/js/views/basic/basic_view.js +++ b/addons/web/static/src/js/views/basic/basic_view.js @@ -109,6 +109,14 @@ var BasicView = AbstractView.extend({ } } } + // Many2one: context is not the same between the different views + // this means the result of a name_get could differ + if (fieldType === 'many2one') { + if (JSON.stringify(record.data[name].context) !== + JSON.stringify(fieldInfo.context)) { + fieldNames.push(name); + } + } } }); -- cgit v1.2.3