From 7c10cb47f12ea9ee5ca2dcb5b999cce11daefefc Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 14 Aug 2015 14:11:51 +0200 Subject: [PATCH] [FIX] web: readonly fields not transferred from dialog to 2many field Transfer options to 'data_create' and 'data_update' Add tour to check the fix --- .../src/js/views/form_relational_widgets.js | 6 +-- addons/web/static/test/x2many.js | 40 ++++++++++++++++++- .../static/src/js/kanban_relational.js | 4 +- 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/addons/web/static/src/js/views/form_relational_widgets.js b/addons/web/static/src/js/views/form_relational_widgets.js index 94fe11a5585..37c98f40077 100644 --- a/addons/web/static/src/js/views/form_relational_widgets.js +++ b/addons/web/static/src/js/views/form_relational_widgets.js @@ -949,7 +949,7 @@ var X2ManyViewManager = ViewManager.extend({ return self.x2m.data_create(data, options); }, write_function: function(id, data, options) { - return self.x2m.data_update(id, data, {}).done(function() { + return self.x2m.data_update(id, data, options).done(function() { self.x2m.reload_current_view(); }); }, @@ -1113,8 +1113,8 @@ var One2ManyListView = X2ManyListView.extend({ res_id: id, context: self.x2m.build_context(), title: _t("Open: ") + self.x2m.string, - write_function: function(id, data) { - return self.x2m.data_update(id, data, {}).done(function() { + write_function: function(id, data, options) { + return self.x2m.data_update(id, data, options).done(function() { self.x2m.reload_current_view(); }); }, diff --git a/addons/web/static/test/x2many.js b/addons/web/static/test/x2many.js index 908ef239577..bb6c1918932 100644 --- a/addons/web/static/test/x2many.js +++ b/addons/web/static/test/x2many.js @@ -224,7 +224,7 @@ Tour.register({ // change message a { - title: "create new message aaa", + title: "edit message a", waitNot: '.modal', waitFor: '.oe_list_field_cell:containsExact(e)', element: '.oe_list_field_cell:containsExact(a)' @@ -240,6 +240,44 @@ Tour.register({ element: '.o_formdialog_save' }, + // change message e + + { + title: "edit message e", + waitNot: '.modal', + waitFor: '.oe_list_field_text:contains(aaa)', + element: '.oe_list_field_cell:containsExact(e)' + }, + + { + title: "open the many2one to select an other user", + element: '.modal .oe_m2o_drop_down_button', + }, + { + title: "select an other user", + element: '.ui-autocomplete li:contains(Demo User)', + }, + { + title: "test one2many's line onchange after many2one", + waitFor: '.oe_form_char_content:contains([test_trigger] Demo User)', + }, + { + title: "test one2many field not triggered onchange", + waitFor: 'textarea[name="message_concat"]:propValueContains([test_trigger] Administrator:e)', + }, + { + title: "save changes", + element: '.o_formdialog_save' + }, + { + title: "test one2many triggered the onchange on save for the line", + waitFor: '.oe_list_content td.oe_list_field_cell.oe_readonly:contains([test_trigger] Demo User)', + }, + { + title: "test one2many triggered the onchange on save", + waitFor: 'textarea[name="message_concat"]:propValueContains([test_trigger] Demo User:e)', + }, + // remove { diff --git a/addons/web_kanban/static/src/js/kanban_relational.js b/addons/web_kanban/static/src/js/kanban_relational.js index 60eb6fcc0ae..7eadb023073 100644 --- a/addons/web_kanban/static/src/js/kanban_relational.js +++ b/addons/web_kanban/static/src/js/kanban_relational.js @@ -62,8 +62,8 @@ var Many2ManyKanbanView = X2ManyKanbanView.extend({ res_id: event.data.id, context: this.x2m.build_context(), title: _t("Open: ") + this.x2m.string, - write_function: function(id, data) { - return self.x2m.data_update(id, data, {}).done(function() { + write_function: function(id, data, options) { + return self.x2m.data_update(id, data, options).done(function() { self.x2m.reload_current_view(); }); },