From dcde363845e205d1bcc3ecb46f5254b8c69ffece Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Fri, 16 Jan 2009 11:18:36 +0100 Subject: [PATCH] modifs bzr revid: fp@tinyerp.com-20090116101836-e4rz24l7e448xi97 --- addons/account/invoice.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index abfbeb2353a..1e79931e059 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -56,6 +56,7 @@ class account_invoice(osv.osv): for line in invoice.tax_line: res[invoice.id]['amount_tax'] += line.amount res[invoice.id]['amount_total'] = res[invoice.id]['amount_tax'] + res[invoice.id]['amount_untaxed'] + print 'res', res return res def _get_journal(self, cr, uid, context): @@ -473,10 +474,12 @@ class account_invoice(osv.osv): def action_move_create(self, cr, uid, ids, *args): ait_obj = self.pool.get('account.invoice.tax') cur_obj = self.pool.get('res.currency') - self.button_compute(cr, uid, ids, context={}, set_total=False) for inv in self.browse(cr, uid, ids): + if not inv.tax_line: + self.button_compute(cr, uid, [inv], context={}, set_total=False) if inv.move_id: continue + print inv.check_total, inv.amount_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 real total does not match the computed total.')) if not inv.date_invoice: