From 13c03caea8683e518653004b0f26805dff21b119 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 4 Jul 2014 11:03:31 +0200 Subject: [PATCH 1/2] [FIX] web_kanban_gauge: bunch of implicit globals in JS code --- addons/web_kanban_gauge/static/src/js/kanban_gauge.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/web_kanban_gauge/static/src/js/kanban_gauge.js b/addons/web_kanban_gauge/static/src/js/kanban_gauge.js index fdae9534764..4d69953810b 100644 --- a/addons/web_kanban_gauge/static/src/js/kanban_gauge.js +++ b/addons/web_kanban_gauge/static/src/js/kanban_gauge.js @@ -83,14 +83,14 @@ instance.web_kanban.GaugeWidget = instance.web_kanban.AbstractField.extend({ // add input if (!self.$el.find(".oe_justgage_edit").size()) { - $div = $('
'); + var $div = $('
'); $div.css({ 'text-align': 'center', 'position': 'absolute', 'width': self.$el.outerWidth() + 'px', 'top': (self.$el.outerHeight()/2-5) + 'px' }); - $input = $('').val(gauge_value); + var $input = $('').val(gauge_value); $input.css({ 'text-align': 'center', 'margin': 'auto', @@ -98,10 +98,10 @@ instance.web_kanban.GaugeWidget = instance.web_kanban.AbstractField.extend({ }); $div.append($input); if (self.options.on_click_label) { - $post_input = $('' + self.options.on_click_label + ''); + var $post_input = $('' + self.options.on_click_label + ''); $div.append($post_input); } - self.$el.prepend($div) + self.$el.prepend($div); $input.focus() .keydown(function (event) { @@ -145,7 +145,7 @@ instance.web_kanban.GaugeWidget = instance.web_kanban.AbstractField.extend({ if (this.options.force_set && !+input_value) { $svg.fadeTo(0, 0.3); - $div = $('
').text(_t("Click to change value")); + var $div = $('
').text(_t("Click to change value")); $div.css(css); this.$el.append($div); } From 798ce97df4fc111c0e2e44f6776904a41fdab03d Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 7 Jul 2014 09:59:05 +0200 Subject: [PATCH 2/2] [IMP] raise exception when a DB request fetches ids it was not asked for Likely caused by a type incoherence e.g. providing an id as string when the table uses integer ids. Postgres performs an implicit conversion from string to integer[0], this wasn't much of an issue in the old API, whatever cache was there would simply not be used, but because the new API's cache is part of its behavior it has a semantic impact and can lead to infinite recursion. [0] more precisely from quoted value, which is untyped --- openerp/models.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/openerp/models.py b/openerp/models.py index 86d702ef582..9e289965733 100644 --- a/openerp/models.py +++ b/openerp/models.py @@ -3231,8 +3231,16 @@ class BaseModel(object): record._cache.update(record._convert_to_cache(vals)) # store failed values in cache for the records that could not be read - missing = self - self.browse(ids) + fetched = self.browse(ids) + missing = self - fetched if missing: + extras = fetched - self + if extras: + raise AccessError( + _("Database fetch misses ids ({}) and has extra ids ({}), may be caused by a type incoherence in a previous request").format( + ', '.join(map(repr, missing._ids)), + ', '.join(map(repr, extras._ids)), + )) # store an access error exception in existing records exc = AccessError( _('The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: %s, Operation: %s)') % \