summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/basic_model.js
diff options
context:
space:
mode:
authorLucas Perais (lpe) <lpe@odoo.com>2018-03-27 10:17:06 +0200
committerLucas Perais (lpe) <lpe@odoo.com>2018-03-28 09:18:07 +0200
commit07435b110440ba41e559373c4494e674e68e5724 (patch)
tree7e96c60eebb0228fd5e83d89439025d6bbd751a8 /addons/web/static/src/js/views/basic/basic_model.js
parentb33d5af4a74e3f4ca515826d4683065e32005e85 (diff)
[FIX] web: correctly display reference field in subview
Have a form view with a O2M. The model at the 'many' end has a reference field Have a record of the second model display in a modal (by clicking on a record in the o2m list) Before this commit: The field reference was not filled up This was because the fields to fetch on the modal creation weren't correctly set. Obvisouly, it also created problem when trying to change the record on the modal: spawning tracebacks because the reference field was not present in the local datas After this commit: The display of the reference field is as expected both in the original form and in the modal OPW 1829822 closes #22468 closes #23896
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_model.js')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js6
1 files changed, 3 insertions, 3 deletions
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 e60e3f15a03..11e2347eba7 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -2011,7 +2011,7 @@ var BasicModel = AbstractModel.extend({
.then(function () {
return $.when(
self._fetchX2Manys(record, options),
- self._fetchReferences(record)
+ self._fetchReferences(record, options)
).then(function () {
return self._postprocess(record, options);
});
@@ -2058,10 +2058,10 @@ var BasicModel = AbstractModel.extend({
* @param {Object} record
* @returns {Deferred}
*/
- _fetchReferences: function (record) {
+ _fetchReferences: function (record, options) {
var self = this;
var defs = [];
- var fieldNames = record.getFieldNames();
+ var fieldNames = options && options.fieldNames || record.getFieldNames();
_.each(fieldNames, function (fieldName) {
var field = record.fields[fieldName];
if (field.type === 'reference') {