Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: Expenses
Entity: hr.expense
Compute Method: _compute_tax_amount
| Inputs | Method | Outputs |
|---|---|---|
|
"""
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.
"""
+ AccountTax = self.env['account.tax']
for expense in self:
if expense.is_multiple_currency:
- base_lines = [expense._convert_to_tax_base_line_dict(
+ base_line = expense._prepare_base_line_for_taxes_computation(
price_unit=expense.total_amount,
+ quantity=1.0,
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']
+ )
+ AccountTax._add_tax_details_in_base_line(base_line, expense.company_id)
+ AccountTax._round_base_lines_tax_details([base_line], expense.company_id)
+ tax_details = base_line['tax_details']
+ expense.tax_amount = tax_details['total_included_currency'] - tax_details['total_excluded_currency']
else: # Mono-currency case computation shortcut
expense.tax_amount = expense.tax_amount_currency
|
|
