[CHG] make 'add a row' a link

bzr revid: xmo@openerp.com-20120806135536-4x6qacw8qp91le2g
This commit is contained in:
Xavier Morel
2012-08-06 15:55:36 +02:00
parent cd96727f50
commit 9149dc60d8
+20 -19
View File
@@ -3501,25 +3501,26 @@ instance.web.form.One2ManyList = instance.web.ListView.List.extend({
var $cell = $('<td>', {
colspan: columns,
'class': 'oe_form_field_one2many_list_row_add'
}).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) {
e.preventDefault();
e.stopPropagation();
// 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();
});
});
}).append(
$('<a>', {href: '#'}).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) {
e.preventDefault();
e.stopPropagation();
// 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();
});
}));
var $padding = this.$current.find('tr:not([data-id]):first');
var $newrow = $('<tr>').append($cell);