[IMP] make clicking of the 'Add a row' row in m2os save&create if there's a row being edited
as requested by apr bzr revid: xmo@openerp.com-20120802074006-d843c10g9jal4nre
This commit is contained in:
parent
9fb21147c0
commit
07d748787b
|
@ -3488,10 +3488,23 @@ instance.web.form.One2ManyList = instance.web.ListView.List.extend({
|
||||||
colspan: columns,
|
colspan: columns,
|
||||||
'class': 'oe_form_field_one2many_list_row_add'
|
'class': 'oe_form_field_one2many_list_row_add'
|
||||||
}).text(_t("Add a row"))
|
}).text(_t("Add a row"))
|
||||||
|
.mousedown(function () {
|
||||||
|
// FIXME: needs to be an official API somehow
|
||||||
|
if (self.view.editor.is_editing()) {
|
||||||
|
self.view.__ignore_blur = true;
|
||||||
|
}
|
||||||
|
})
|
||||||
.click(function (e) {
|
.click(function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
self.view.do_add_record();
|
// FIXME: there should also be an API for that one
|
||||||
|
if (self.view.editor.form.__blur_timeout) {
|
||||||
|
clearTimeout(self.view.editor.form.__blur_timeout);
|
||||||
|
self.view.editor.form.__blur_timeout = false;
|
||||||
|
}
|
||||||
|
self.view.ensure_saved().then(function () {
|
||||||
|
self.view.do_add_record();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.$current.append(
|
this.$current.append(
|
||||||
$('<tr>').append($cell))
|
$('<tr>').append($cell))
|
||||||
|
|
Loading…
Reference in New Issue