[FIX] account: taxes with analytic account

The account move line created for a tax(with analytic = True) must have
the same account_analytic_id than the account move line created for the
taxed amount.

opw:694821
This commit is contained in:
Goffin Simon
2016-12-12 15:02:56 +01:00
parent 5b39b8b1db
commit 731cf476b2
+2
View File
@@ -1093,6 +1093,7 @@ class AccountMoveLine(models.Model):
# Create tax lines
for tax_vals in res['taxes']:
if tax_vals['amount']:
tax = self.env['account.tax'].browse([tax_vals['id']])
account_id = (amount > 0 and tax_vals['account_id'] or tax_vals['refund_account_id'])
if not account_id: account_id = vals['account_id']
temp = {
@@ -1104,6 +1105,7 @@ class AccountMoveLine(models.Model):
'statement_id': vals.get('statement_id'),
'debit': tax_vals['amount'] > 0 and tax_vals['amount'] or 0.0,
'credit': tax_vals['amount'] < 0 and -tax_vals['amount'] or 0.0,
'analytic_account_id': vals.get('analytic_account_id') if tax.analytic else False,
}
bank = self.env["account.bank.statement"].browse(vals.get('statement_id'))
if bank.currency_id != bank.company_id.currency_id: