From d38adf3d9247fc65d83ea57edfaa5fba7b82404c Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 9 Oct 2014 18:56:21 +0200 Subject: [PATCH] [FIX] account_invoice: using has_group to determine if user has group group_supplier_inv_check_total has_group do not care about the fact res.groups is access restricted --- addons/account/account_invoice.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 25e6cbae0ec..9390e2cf3fd 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -925,9 +925,7 @@ class account_invoice(osv.osv): self.check_tax_lines(cr, uid, inv, compute_taxes, ait_obj) # I disabled the check_total feature - group_check_total_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'group_supplier_inv_check_total')[1] - group_check_total = self.pool.get('res.groups').browse(cr, uid, group_check_total_id, context=context) - if group_check_total and uid in [x.id for x in group_check_total.users]: + if self.pool['res.users'].has_group(cr, uid, 'account.group_supplier_inv_check_total'): if (inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding/2.0)): raise osv.except_osv(_('Bad Total!'), _('Please verify the price of the invoice!\nThe encoded total does not match the computed total.'))