[FIX] hr_expense: analytic tax

- Enable Include in Analytic Cost in purchase tax P
- Create an expense
- Select product, purchase tax P, set analytic account and tags
- Create report, submit to manager, approve, post journal entries

The tax `account.move.line` does not have the analytic account and tags
assigned.

The information is missing at the tax line creation, so apply the same
logic than:

https://github.com/odoo/odoo/blob/784d22bd005db7825375a97caf9661bd5d463efe/addons/account/models/account_invoice.py#L1055-L1057

opw-2250257

closes odoo/odoo#50879

X-original-commit: ec6fe8cdff7a072a6d44e5a2a40ca0da43254f7d
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2020-05-07 15:55:33 +00:00
parent fb8a69706f
commit a9d117178f
+2
View File
@@ -437,6 +437,8 @@ class HrExpense(models.Model):
'expense_id': expense.id,
'partner_id': partner_id,
'currency_id': expense.currency_id.id if different_currency else False,
'analytic_account_id': expense.analytic_account_id.id if tax['analytic'] else False,
'analytic_tag_ids': [(6, 0, expense.analytic_tag_ids.ids)] if tax['analytic'] else False,
}
total_amount -= amount
total_amount_currency -= move_line_tax_values['amount_currency'] or amount