diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 0508a7cadfe..d3d37907538 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -865,8 +865,11 @@ class account_invoice(osv.osv): self.check_tax_lines(cr, uid, inv, compute_taxes, ait_obj) # I disabled the check_total feature - #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 real total does not match the computed total.')) + 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 (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.')) if inv.payment_term: total_fixed = total_percent = 0 diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 5ed373456f3..2699fffaacc 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -186,6 +186,7 @@ + diff --git a/addons/account/res_config.py b/addons/account/res_config.py index 17df4377548..ab271eabc34 100644 --- a/addons/account/res_config.py +++ b/addons/account/res_config.py @@ -120,6 +120,8 @@ class account_config_settings(osv.osv_memory): 'group_analytic_accounting': fields.boolean('Analytic accounting', implied_group='analytic.group_analytic_accounting', help="Allows you to use the analytic accounting."), + 'group_check_supplier_invoice_total': fields.boolean('Check the Total of Supplier Invoices', + implied_group="account.group_supplier_inv_check_total"), } def _default_company(self, cr, uid, context=None): diff --git a/addons/account/res_config_view.xml b/addons/account/res_config_view.xml index 728eefe8078..d4bafca41be 100644 --- a/addons/account/res_config_view.xml +++ b/addons/account/res_config_view.xml @@ -220,6 +220,10 @@