From 0e664c9e93ba4c64cb31a8b8f0a2203750b7eb64 Mon Sep 17 00:00:00 2001 From: "Dharti Ratani (Open ERP)" Date: Fri, 29 Mar 2013 14:15:28 +0530 Subject: [FIX]Fix the issue of editing inline many2one values doesn't show up with field name legth bzr revid: dhr@tinyerp.com-20130329084528-a3ppzy7paww97yc7 --- addons/web/static/src/js/view_list.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'addons/web/static/src/js/view_list.js') diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 3c89ef7126e..33a4aa1c3cd 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -534,8 +534,9 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi self.records.remove(record); return; } - _(records[0]).each(function (value, key) { - record.set(key, value, {silent: true}); + var transfer_value = records[0]; + _(_.keys(transfer_value)).each(function(key){ + record.set(key, transfer_value[key], {silent: true}); }); record.trigger('change', record); }); -- cgit v1.2.3 From d8dd8fc14bda8e3888a1580b9e344754b862f558 Mon Sep 17 00:00:00 2001 From: Mohammed Shekha Date: Thu, 9 May 2013 14:21:02 +0530 Subject: [FIX]Fixe the issue of listview record re-ordering which is not working due to revision 3898. bzr revid: msh@openerp.com-20130509085102-ln4lidp7caqw25ur --- addons/web/static/src/js/view_list.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js/view_list.js') diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index b96079d2051..c39406a7e4a 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -896,7 +896,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. this.record_callbacks = { 'remove': function (event, record) { var id = record.get('id'); - self.dataset.remove_ids([id]) + self.dataset.remove_ids([id]); var $row = self.$current.children('[data-id=' + id + ']'); var index = $row.data('index'); $row.remove(); @@ -925,6 +925,8 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. }, 'add': function (ev, records, record, index) { var $new_row = $(self.render_record(record)); + var id = record.get('id'); + self.dataset.add_ids([id]); if (index === 0) { $new_row.prependTo(self.$current); -- cgit v1.2.3 From 7ad343636b98e894a599b1578d90f4d3007d69d9 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 6 Jun 2013 16:26:16 +0200 Subject: [FIX] view_list: when we have more than 80 record in list and we create new record and switch the views like form->list->form gives traceback. Get if the index is over the number of visible records bzr revid: chm@openerp.com-20130606142616-41xxepfzkdvyqu9m --- addons/web/static/src/js/view_list.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'addons/web/static/src/js/view_list.js') diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index b96079d2051..357e9beffab 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -503,12 +503,9 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi var reloaded = $.Deferred(); this.$el.find('.oe_list_content').append( this.groups.render(function () { - if (self.dataset.index == null) { - var has_one = false; - self.records.each(function () { has_one = true; }); - if (has_one) { + if (self.dataset.index == null && self.records.length || + self.dataset.index >= self.records.length) { self.dataset.index = 0; - } } self.compute_aggregates(); reloaded.resolve(); -- cgit v1.2.3 From 1ea609ba651c070d1d90c3321a210a2346de17ea Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 7 Jun 2013 17:23:26 +0200 Subject: [FIX] bugs discovered by failing onwrite test case Following xmo@openerp.com-20130607120355-x3poxy2ar2bpqqvw: * add_ids should not add ids which are already in the dataset, this leads to duplicates which the web client does not overly like * methods which add or remove records should not manipulate dataset.ids as well as that's now automatic (on_write feature) * record add should only insert the id in the dataset on non-false ids (e.g. list edition uses "pending" record with false id during creation, then sets the id it got from create() call) bzr revid: xmo@openerp.com-20130607152326-2pja1kuwo0ropfuw --- addons/web/static/src/js/view_list.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'addons/web/static/src/js/view_list.js') diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 60c3acad107..9d09316f618 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -906,12 +906,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. throw new Error(_.str.sprintf( _t("Setting 'id' attribute on existing record %s"), JSON.stringify(record.attributes) )); } - if (!_.contains(self.dataset.ids, value)) { - // add record to dataset if not already in (added by - // the form view?) - self.dataset.ids.splice( - self.records.indexOf(record), 0, value); - } + self.dataset.add_ids([value], self.records.indexOf(record)); // Set id on new record $row = self.$current.children('[data-id=false]'); } else { @@ -923,7 +918,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. 'add': function (ev, records, record, index) { var $new_row = $(self.render_record(record)); var id = record.get('id'); - self.dataset.add_ids([id], index); + if (id) { self.dataset.add_ids([id], index); } if (index === 0) { $new_row.prependTo(self.$current); -- cgit v1.2.3 From aa416a9951e57bb86c78df355c9441edf27dff5f Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 10 Jun 2013 09:10:36 +0200 Subject: [IMP] use introduced variable across function bzr revid: xmo@openerp.com-20130610071036-8w771r4urq5j31zz --- addons/web/static/src/js/view_list.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'addons/web/static/src/js/view_list.js') diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 0f4225a54db..74c2fc47aee 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -527,13 +527,13 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi return r.tag === 'field'; }), 'name') ).done(function (records) { - if (!records[0]) { + var values = records[0]; + if (!values) { self.records.remove(record); return; } - var transfer_value = records[0]; - _(_.keys(transfer_value)).each(function(key){ - record.set(key, transfer_value[key], {silent: true}); + _(_.keys(values)).each(function(key){ + record.set(key, values[key], {silent: true}); }); record.trigger('change', record); }); -- cgit v1.2.3