[ADD] 'false' id to newly created records, otherwise format_cell's button rendering blows up

also fix various bits of code looking for an absence of @data-id, so that they look for a false @data-id to match the row of the new record instead

bzr revid: xmo@openerp.com-20120709084652-rt1ffu2ea20scw53
This commit is contained in:
Xavier Morel 2012-07-09 10:46:52 +02:00
parent cd59881b05
commit 853c5a70c0
2 changed files with 6 additions and 15 deletions

View File

@ -905,13 +905,8 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
this.record_callbacks = {
'remove': function (event, record) {
var $row;
if (!record.get('id')) {
$row = self.$current.children(':not([data-id])');
} else {
$row = self.$current.children(
'[data-id=' + record.get('id') + ']');
}
var $row = self.$current.children(
'[data-id=' + record.get('id') + ']');
var index = $row.data('index');
$row.remove();
self.refresh_zebra(index);
@ -928,7 +923,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
self.dataset.ids.splice(
self.records.indexOf(record), 0, value);
// Set id on new record
$row = self.$current.children('tr:not([data-id])');
$row = self.$current.children('[data-id=false]');
} else {
$row = self.$current.children(
'[data-id=' + record.get('id') + ']');

View File

@ -125,7 +125,7 @@ openerp.web.list_editable = function (instance) {
startEdition: function (record) {
var self = this;
if (!record) {
var attrs = {};
var attrs = {id: false};
_(this.columns).chain()
.filter(function (x) { return x.tag === 'field'})
.pluck('name')
@ -499,12 +499,8 @@ openerp.web.list_editable = function (instance) {
* @return {jQuery|null}
*/
getRowFor: function (record) {
var id, $row;
if (id = record.get('id')) {
$row = this.$current.children('[data-id=' + id + ']');
} else {
$row = this.$current.children(':not([data-id])');
}
var id;
var $row = this.$current.children('[data-id=' + record.get('id') + ']');
if ($row.length) {
return $row;
}