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_from_product

View 17.0 View 20.0
Inputs Method Outputs
  • product_id
  • company_currency_id
  • product_id.standard_price
  • product_id.supplier_taxes_id
  • company_id
  • product_has_cost
  • state
  • quantity
for expense in self:
            expense.product_has_cost = expense.product_id and not expense.company_currency_id.is_zero(expense.product_id.standard_price)
-             tax_ids = expense.product_id.supplier_taxes_id.filtered_domain(self.env['account.tax']._check_company_domain(expense.company_id))
-             expense.product_has_tax = bool(tax_ids)
-             if not expense.product_has_cost and expense.state in {'draft', 'reported'} and expense.quantity != 1:
-                 expense.quantity = 1
+             expense.product_has_tax = bool(expense.product_id.supplier_taxes_id.filtered_domain(self.env['account.tax']._check_company_domain(expense.company_id)))
  • product_has_cost
  • product_has_tax
  • quantity

Back to entity