summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2016-05-23 13:16:39 +0200
committerGéry Debongnie <ged@odoo.com>2016-05-23 13:53:05 +0200
commit0eaaeb68bc28917f86f7cfe646d2512dac54cc93 (patch)
tree392fd4b62eaf02d0f31b8aed77abf04bbfdc4328 /addons/web/static/src
parent90130744e04b4a15973a484a78d461208920e510 (diff)
[FIX] web: better blur handling in m2m in wizards
Before this commit, many2many list views in wizards did not handle the blur event at all, which means that the last edited line was ignored. This is quite a large bug, but not really visible in our standard install, because we had no many2many in wizards. This commit add naive support for blur events. This is only intended to help the MRP team. A complete solution would probably involve moving most of the code in One2ManyListView to X2ManyListView.
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/form_relational_widgets.js16
1 files changed, 16 insertions, 0 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 8e64599f470..ce64380f391 100644
--- a/addons/web/static/src/js/views/form_relational_widgets.js
+++ b/addons/web/static/src/js/views/form_relational_widgets.js
@@ -1277,6 +1277,8 @@ var Many2ManyListView = X2ManyListView.extend({
this.options = _.extend(this.options, {
ListType: X2ManyList,
});
+ this.on('edit:after', this, this.proxy('_after_edit'));
+ this.on('save:before cancel:before', this, this.proxy('_before_unedit'));
},
do_add_record: function () {
var self = this;
@@ -1323,6 +1325,20 @@ var Many2ManyListView = X2ManyListView.extend({
});
}
},
+ _after_edit: function () {
+ this.editor.form.on('blurred', this, this._on_blur_many2many);
+ },
+ _before_unedit: function () {
+ this.editor.form.off('blurred', this, this._on_blur_many2many);
+ },
+ _on_blur_many2many: function() {
+ return this.save_edition().done(function () {
+ if (self._dataset_changed) {
+ self.dataset.trigger('dataset_changed');
+ }
+ });
+ },
+
});
var FieldMany2Many = FieldX2Many.extend({