1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# account_invoice_total module for OpenERP
5
# Copyright (C) 2012 Ren Dao Solutions (<http://rendaosolutions.com>).
6
# Copyright (C) 2012 Acsone (<http://acsone.eu>).
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU Affero General Public License as
10
# published by the Free Software Foundation, either version 3 of the
11
# License, or (at your option) any later version.
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU Affero General Public License for more details.
18
# You should have received a copy of the GNU Affero General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
##############################################################################
23
from osv import fields, osv
24
from tools.translate import _
26
class account_invoice_total(osv.osv):
27
_inherit = 'account.invoice'
29
def action_move_create(self, cr, uid, ids, context=None):
30
res = super(account_invoice_total, self).action_move_create(cr, uid, ids, context=context)
31
for inv in self.browse(cr, uid, ids, context=context):
32
if inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding/2.0):
33
raise osv.except_osv(_('Bad total !'), _('Please verify the price of the invoice !\nThe real total does not match the computed total.'))
36
account_invoice_total()
38
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: