Skip to content

Commit

Permalink
Merge pull request odoo#967 from xmo-odoo/master-id-type-xmo
Browse files Browse the repository at this point in the history
Raise exception when a DB request fetches ids it was not asked for
  • Loading branch information
xmo-odoo committed Jul 7, 2014
2 parents 831b857 + 798ce97 commit cd7e9a9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 5 additions & 5 deletions addons/web_kanban_gauge/static/src/js/kanban_gauge.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,25 +86,25 @@ instance.web_kanban.GaugeWidget = instance.web_kanban.AbstractField.extend({

// add input
if (!self.$el.find(".oe_justgage_edit").size()) {
$div = $('<div class="oe_justgage_edit" style="z-index:1"/>');
var $div = $('<div class="oe_justgage_edit" style="z-index:1"/>');
$div.css({
'text-align': 'center',
'position': 'absolute',
'width': self.$el.outerWidth() + 'px',
'top': (self.$el.outerHeight()/2-5) + 'px'
});
$input = $('<input/>').val(gauge_value);
var $input = $('<input/>').val(gauge_value);
$input.css({
'text-align': 'center',
'margin': 'auto',
'width': ($svg.outerWidth()-40) + 'px'
});
$div.append($input);
if (self.options.on_click_label) {
$post_input = $('<span style="color: #000000;">' + self.options.on_click_label + '</span>');
var $post_input = $('<span style="color: #000000;">' + self.options.on_click_label + '</span>');
$div.append($post_input);
}
self.$el.prepend($div)
self.$el.prepend($div);

$input.focus()
.keydown(function (event) {
Expand Down Expand Up @@ -148,7 +148,7 @@ instance.web_kanban.GaugeWidget = instance.web_kanban.AbstractField.extend({

if (this.options.force_set && !+input_value) {
$svg.fadeTo(0, 0.3);
$div = $('<div/>').text(_t("Click to change value"));
var $div = $('<div/>').text(_t("Click to change value"));
$div.css(css);
this.$el.append($div);
}
Expand Down
10 changes: 9 additions & 1 deletion openerp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3231,8 +3231,16 @@ def qualify(f):
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)') % \
Expand Down

0 comments on commit cd7e9a9

Please sign in to comment.