From 9636e05bf01d708da148591423bc32dd8e100434 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Mon, 13 Mar 2017 13:56:39 +0100 Subject: [FIX] web: use correct domain when fetching status values The m2o choices that a status field works with are determined using the associated domain. If the current value is not matched by this domain, the current value should still be visible so the domain is automatically extended to match this current value. The problem is that the current value in edit mode or in create mode is not given by the `data` attribute of the associated datapoint. Indeed, user changes and default get are stored in the `_changes` key and it is those values that must be used if they exist. --- addons/web/static/src/js/views/basic/basic_model.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src/js/views/basic/basic_model.js') diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js index 8e534d4eda1..7797abfc3f6 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -1413,7 +1413,7 @@ var BasicModel = AbstractModel.extend({ var context = record.getContext({fieldName: fieldName}); var domain = record.getDomain({fieldName: fieldName}); if (domain.length) { - var localID = record.data[fieldName]; + var localID = record._changes && record._changes[fieldName] || record.data[fieldName]; if (localID) { var element = this.localData[localID]; domain = ["|", ["id", "=", element.data.id]].concat(domain); -- cgit v1.2.3