summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGoffin Simon <sig@odoo.com>2016-12-12 16:17:17 +0100
committerGoffin Simon <sig@odoo.com>2016-12-13 10:10:35 +0100
commitea021ff17afb06576d2e0fce74a6cde4e9979792 (patch)
tree7ca30cbbdc09f1b5175cc083dec97502abfbebef
parent72a4229130fb4096064fb34240d13594ccb29e1e (diff)
[FIX] account: taxes with analytic account
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
-rw-r--r--addons/account/account_move_line.py4
1 files changed, 4 insertions, 0 deletions
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']