|
|
"""
Note: as total_amount can be set directly by the user when the currency_rate is overriden,
the tax must be computed after the total_amount.
"""
for expense in self:
if expense.is_multiple_currency:
base_lines = [expense._convert_to_tax_base_line_dict(
price_unit=expense.total_amount,
currency=expense.company_currency_id,
)]
taxes_totals = self.env['account.tax']._compute_taxes(base_lines)['totals'][expense.company_currency_id]
expense.tax_amount = taxes_totals['amount_tax']
else: # Mono-currency case computation shortcut
expense.tax_amount = expense.tax_amount_currency
|
|