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_total_amount
| Inputs | Method | Outputs |
|---|---|---|
|
AccountTax = self.env['account.tax'] for expense in self: + if not expense.company_id: + # This would be happening when emptying the required company_id field, triggering the "onchange"s. + # A traceback would occur because company_currency_id would be set to False. + # Instead of using the env company, recomputing the interface just to be blocked when trying to save + # we choose not to recompute anything and wait for a proper company to be inputted. + continue + if expense.is_multiple_currency: base_line = expense._prepare_base_line_for_taxes_computation( price_unit=expense.total_amount_currency * expense.currency_rate, quantity=1.0, currency_id=expense.company_currency_id, rate=1.0, ) AccountTax._add_tax_details_in_base_line(base_line, expense.company_id) AccountTax._round_base_lines_tax_details([base_line], expense.company_id) expense.total_amount = base_line['tax_details']['total_included_currency'] else: # Mono-currency case computation shortcut expense.total_amount = expense.total_amount_currency |
|
