[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:
parent
cd59881b05
commit
853c5a70c0
|
@ -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') + ']');
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue