From f83684265d4bf7b4d59789873cc1571810ee8df6 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 28 Jun 2012 16:14:03 +0200 Subject: [PATCH] [FIX] make edition of existing records kinda-sorta work (if the record is 'saved' by clicking on an other one) bzr revid: xmo@openerp.com-20120628141403-z8kdg24xy5thmg50 --- addons/web/static/src/js/view_list.js | 16 +- .../web/static/src/js/view_list_editable.js | 295 ++++++++++++++---- 2 files changed, 242 insertions(+), 69 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 7d1770069f8..49e6eceb4d8 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -1133,6 +1133,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. * @returns {String} QWeb rendering of the selected record */ render_record: function (record) { + var self = this; var index = this.records.indexOf(record); return QWeb.render('ListView.row', { columns: this.columns, @@ -1141,7 +1142,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. row_parity: (index % 2 === 0) ? 'even' : 'odd', view: this.view, render_cell: function () { - return this.render_cell.apply(this, arguments); } + return self.render_cell.apply(self, arguments); } }); }, /** @@ -1843,6 +1844,19 @@ var Collection = instance.web.Class.extend(/** @lends Collection# */{ }, // underscore-type methods + find: function (callback) { + var record = null; + for(var section in this._proxies) { + if (this._proxies.hasOwnProperty(section)) { + record = this._proxies[section].find(callback); + } + if (record) { return record; } + } + for(var i=0; i