summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/relational_fields.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2018-04-24 10:32:45 +0200
committerAaron Bohy <aab@odoo.com>2018-05-04 10:42:05 +0200
commit6e15a9cd24eb5825ea615512a4ee834f131a60f7 (patch)
tree99e13ecbd53cbd8cb0fb51a8d5419d214307c11c /addons/web/static/src/js/fields/relational_fields.js
parent901658df26bd3465e226fb589219d7620eda08c6 (diff)
[FIX] web: one2many form view with action button
Assume a one2many field inside a form, displaying field A in its list view, and a field B in its (dialog) form view. Moreover, there is an action button in the dialog, which updates the value of B. Before this rev., B wasn't correctly reloaded when the button was clicked, because the BasicModel reloaded the fields on the list view (i.e. field A), whereas it should reload the fields in both views. This fix is twofold. First, we force the viewType to 'form' when the record is reloaded, instead of the default ('list'), so that fields in the form view are correctly reloaded. Second, when we open the form view in the dialog, we add the fields of the list view to the dict of fields of the form view, so that the form is aware of those fields and can ask the model to reload them (still without displaying them). Fixes #24189
Diffstat (limited to 'addons/web/static/src/js/fields/relational_fields.js')
-rw-r--r--addons/web/static/src/js/fields/relational_fields.js5
1 files changed, 1 insertions, 4 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js
index 5c670e11c73..c9fe8648c17 100644
--- a/addons/web/static/src/js/fields/relational_fields.js
+++ b/addons/web/static/src/js/fields/relational_fields.js
@@ -1293,10 +1293,7 @@ var FieldOne2Many = FieldX2Many.extend({
var self = this;
var id = ev.data.id;
- var onSaved = function (record, hasChanged) {
- if (!hasChanged) {
- return;
- }
+ var onSaved = function (record) {
if (_.some(self.value.data, {id: record.id})) {
// the record already exists in the relation, so trigger an
// empty 'UPDATE' operation when the user clicks on 'Save' in