From 85e33c8e1d4b0d718450d959f8c49bf8c1e50648 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Fri, 4 Dec 2015 10:50:58 +0100 Subject: [PATCH] [FIX] account_anglo_saxon: incorrect account tax When changing the account_id of an invoice line, all the tax line, created from this invoice line and with a tax which has no "account_collected_id" set, must be set with the same account_id. Inspired from the function "compute" in model "account.invoice.tax" closed #9727 opw:657499 --- addons/account_anglo_saxon/stock.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/account_anglo_saxon/stock.py b/addons/account_anglo_saxon/stock.py index 37dab7b4b86..29d46a211bd 100644 --- a/addons/account_anglo_saxon/stock.py +++ b/addons/account_anglo_saxon/stock.py @@ -54,6 +54,11 @@ class stock_picking(osv.osv): if oa: fpos = ol.invoice_id.fiscal_position or False a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa) + tax_line = ol.invoice_line_tax_id.filtered(lambda l: not l.account_collected_id) if ol.invoice_line_tax_id else False + if tax_line: + for tax in tax_line: + tax_id = self.pool['account.invoice.tax'].search(cr, uid, [('invoice_id', '=', ol.invoice_id.id), ('name', '=', tax.name), ('account_id', '=', ol.account_id.id)], limit=1) + self.pool['account.invoice.tax'].write(cr, uid, tax_id, {'account_id': a}) self.pool.get('account.invoice.line').write(cr, uid, [ol.id], {'account_id': a}) return res