Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: HR Contract Bonus

Entity: hr.contract

Compute Method: _compute_total_annual_wage_with_bonus

Inputs Method Outputs
for contract in self:
            contract.total_annual_wage_with_bonus = contract.wage * 12
            if contract.bonus_ids:
                for bonus in contract.bonus_ids:
                    if bonus.type == "fixed":
                        if bonus.frequency == "monthly":
                            contract.total_annual_wage_with_bonus += bonus.amount * 12

                        else:
                            contract.total_annual_wage_with_bonus += bonus.amount
                    else:
                        if bonus.frequency == "monthly":
                            contract.total_annual_wage_with_bonus += (
                                contract.wage * (bonus.amount / 100)
                            ) * 12
                        else:
                            contract.total_annual_wage_with_bonus += (
                                contract.wage * 12
                            ) * (bonus.amount / 100)

            contract.total_annual_wage_with_bonus = round(
                contract.total_annual_wage_with_bonus, 2
            )

Back to entity