[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
This commit is contained in:
parent
72a4229130
commit
ea021ff17a
|
@ -1434,6 +1434,9 @@ class account_move_line(osv.osv):
|
||||||
#create the Tax movement
|
#create the Tax movement
|
||||||
if not tax['amount'] and not tax[tax_code]:
|
if not tax['amount'] and not tax[tax_code]:
|
||||||
continue
|
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 = {
|
data = {
|
||||||
'move_id': vals['move_id'],
|
'move_id': vals['move_id'],
|
||||||
'name': tools.ustr(vals['name'] or '') + ' ' + tools.ustr(tax['name'] or ''),
|
'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'],
|
'account_id': tax[account_id] or vals['account_id'],
|
||||||
'credit': tax['amount']<0 and -tax['amount'] or 0.0,
|
'credit': tax['amount']<0 and -tax['amount'] or 0.0,
|
||||||
'debit': 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)
|
self.create(cr, uid, data, context)
|
||||||
del vals['account_tax_id']
|
del vals['account_tax_id']
|
||||||
|
|
Loading…
Reference in New Issue