From ea021ff17afb06576d2e0fce74a6cde4e9979792 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 12 Dec 2016 16:17:17 +0100 Subject: [PATCH] =?UTF-8?q?[FIX]=C2=A0account:=20taxes=20with=20analytic?= =?UTF-8?q?=20account?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The account move line created for a tax must have the right account_analytic_id according CONDITION. CONDITION(inspired from function compute defined on model "account.invoice.tax") if the tax is for an "in_invoice" or an "out_invoice" => tax_code = 'tax_code_id' => the account_analytic_id of the tax must be set to 'account_analytic_collected_id' if the tax is for an "out_refund" or an "in_refund" => tax_code = 'ref_tax_code_id' => the account_analytic_id of the tax must be set to 'account_analytic_paid_id' note:forward-port upto saas-6 opw:694821 --- addons/account/account_move_line.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index c4042625691..982b1d8c23b 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -1434,6 +1434,9 @@ class account_move_line(osv.osv): #create the Tax movement if not tax['amount'] and not tax[tax_code]: continue + #FORWARD-PORT UPTO SAAS-6 + tax_analytic = (tax_code == 'tax_code_id' and tax.get('account_analytic_collected_id')) or (tax_code == 'ref_tax_code_id' and tax.get('account_analytic_paid_id')) + data = { 'move_id': vals['move_id'], 'name': tools.ustr(vals['name'] or '') + ' ' + tools.ustr(tax['name'] or ''), @@ -1447,6 +1450,7 @@ class account_move_line(osv.osv): 'account_id': tax[account_id] or vals['account_id'], 'credit': tax['amount']<0 and -tax['amount'] or 0.0, 'debit': tax['amount']>0 and tax['amount'] or 0.0, + 'analytic_account_id': tax_analytic, } self.create(cr, uid, data, context) del vals['account_tax_id']