diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 2e5550325b7..de343eedfd1 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -483,13 +483,9 @@ class account_invoice(osv.osv): cur_obj = self.pool.get('res.currency') for inv in self.browse(cr, uid, ids): - if not inv.tax_line: - self.button_compute(cr, uid, [inv.id], context={}, set_total=False) if inv.move_id: continue - 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: self.write(cr, uid, [inv.id], {'date_invoice':time.strftime('%Y-%m-%d')}) company_currency = inv.company_id.currency_id.id @@ -519,6 +515,9 @@ class account_invoice(osv.osv): if not key in tax_key: raise osv.except_osv(_('Warning !'), _('Taxes missing !')) + 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.')) + # one move line per tax line iml += ait_obj.move_line_get(cr, uid, inv.id) @@ -986,7 +985,7 @@ class account_invoice_line(osv.osv): taxes = res.taxes_id and res.taxes_id or (a and self.pool.get('account.account').browse(cr, uid,a).tax_ids or False) tax_id = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes) else: - taxes = res.taxes_id and res.taxes_id or (a and self.pool.get('account.account').browse(cr, uid,a).tax_ids or False) + taxes = res.supplier_taxes_id and res.supplier_taxes_id or (a and self.pool.get('account.account').browse(cr, uid,a).tax_ids or False) tax_id = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes) if type in ('in_invoice', 'in_refund'): to_update = self.product_id_change_unit_price_inv(cr, uid, tax_id, price_unit, qty, address_invoice_id, product, partner_id, context=context)