Skip to main content

Remuneration

General Description

Remuneration is the feature for payroll admin to categorized and compute the remuneration for employees. This feature could be useful when the company has to give their employee irregular payment like bonus or allowance (THR) that is uninlcuded in regular monthly payslips. Remuneration Dashboard

Remuneration Attribute

  1. Name
  2. Period (valid_from & valid_to)
  3. Payment Type
  4. Company
  5. Payroll Admin

Create Remuneration Dashboard

In order to create a remuneration, users need to fill the Name, Period, Payment Type, and Payroll Admin fields or there will be error message about the invalid input in the required fields.

Invalid Message

If the required fields have already filled by the user, user could save the remuneration without any error message.

Successfully created

Entity Relationship Diagram of Remuneration

ERD Remuneration

info

Fonts in red means unnecessary field placement.

Payment Type

Remuneration which is categorized on Regular payment will automatically calculated into Salary Computation and will be paid along with the monthly payroll.

Other Features

Other features

Confirm

This feature basically change the value of variable self.state to "confirmed"

Mark as Done

This feature basically change the value of variable self.state to "done"

Compute

Compute feature is functioned to calculate all the salary components that are inputed from SAP system. The calculation does not generated by system in Odoo, so the results of the components are calculated in SAP then they are inputed in Odoo to be generated into employee payslips. The function that is used called udf_hr_ins_py_remuneration_line. Basically, it is creating a temporary table to accommodate the data which are selected from real tables in the database.

1. First, it deletes data if there is any employee id that has the same value as inputed parameter in hr_remuneration_line and hr_remuneration_line_header table, then it inserts new rows into the hr_remuneration_line_header table by selecting distinct data from various other tables (hr_employee, hr_contract, hr_temp_attribute, hr_wage_type, hr_attribute, hr_remuneration_line_header, hr_remuneration) based on certain conditions. The inserted data includes the rem_id, emp_id, valid_from, valid_to, payment_type, contract_id, company_id, pyr_admin_id, active, state, create_uid, create_date, write_uid, write_date.

2. The query is filtering the data based on certain conditions (e.g. pyr_admin_id, company_id, employee_id, type='SAP', hta.active=true, hta.period between _validfrom and _validto)

3. Second, it inserts new rows into the hr_remuneration_line table by selecting distinct data from various other tables (hr_employee, hr_contract, hr_temp_attribute, hr_wage_type, hr_attribute, hr_remuneration_line, hr_remuneration_line_header) based on certain conditions. The inserted data includes the rem_header_id, emp_id, valid_from, valid_to, code, amount, create_date, create_uid, write_uid, write_date, wage_type_id, name, attribute_id.

4. The query is filtering the data based on certain conditions (e.g. pyr_admin_id, company_id, employee_id, type='SAP', hta.active=true, hta.period between _validfrom and _validto, ha.payment_type=_payment_hr_attribute)

Compute Loan Installment

Compute Loan Installment feature is functioned to calculate if there is any employee loan that need to be paid. The function that is used is called udf_hr_compute_loan_percentage. The generated loan will also be generated into employee payslips.

1. It creates a temporary table named temp_compute_loan_percentage that has three columns: employee_id, loan_id, and total_amount.

2. It inserts data into the temp_compute_loan_percentage table by selecting from the "hr_remuneration_line" table, joining it with the "hr_remuneration_line_header" and "employee_loan_percentage" tables, and using a case statement to compute the total amount based on the remaining amount of the loan and the percentage in the "employee_loan_percentage" table.

3. It inserts data into the temp_compute_loan_percentage table by selecting from the "hr_contract" table, joining it with the "employee_loan" and "employee_loan_percentage" tables, and using a case statement to compute the total amount based on the percentage in the "employee_loan_percentage" table and the wage or transportation in the "hr_contract" table.

4. It inserts data into the temp_compute_loan_percentage table by selecting from the "hr_contract_attribute" table, joining it with the "hr_attribute", "employee_loan" and "employee_loan_percentage" tables, and using the value of the contract attribute, percentage and code of the "employee_loan_percentage" table to compute the total amount.

5. It selects the count of installment lines that are not paid yet, where the loan id is present in the temp_compute_loan_percentage table and the date is before the _validfrom variable.

6. If the count is equal to 0, it opens a cursor named "cur_payroll" and loops through the records, fetching the sum of the total amounts from the temp_compute_loan_percentage table for each record, and performing some additional actions.

7. It performs additional actions on installment_line table, such as update and insert statements.

Compute Eligible

Like the compute feature, Compute Eligible is functioned to calculate all the salary components. But only the components that are eligible or fulfill all the conditions to be generated automatically by the system. The conditions include the completion of supporting components to do the calculation and as soon as the calculation be done, the data will be generated into employee payslips. The function that is used called udf_hr_ins_py_remuneration_line_eligible. This function also provides temporary table that accomodate data from the real tables in the database.

1. First, it deletes rows from the hr_remuneration_line table by joining it with hr_remuneration_line_header and hr_attribute tables, where the rem_header_id is equal to a specific id (_rem_id) and the type of the attribute is 'Calc'.

2. Second, it deletes rows from the hr_remuneration_line_header table, where the id is in a subquery that selects ids from hr_remuneration_line_header and hr_remuneration_line, where the rem_id is equal to _rem_id and there is no corresponding row in the hr_remuneration_line table.

3. Third, it inserts new rows into the hr_remuneration_line_header table by selecting distinct data from various other tables (hr_employee, hr_contract, hr_contract_type, hr_attribute, hr_wage_type, month_hr_attribute_rel, hr_month, hr_attribute_hr_kg_payroll_configuration_rel, hr_kg_payroll_configuration, religion_hr_attribute_rel, hr_religion, hr_remuneration_line_header) based on certain conditions. The inserted data includes the rem_id, emp_id, valid_from, valid_to, payment_type, contract_id, company_id, pyr_admin_id, active, state, create_uid, create_date, write_uid, write_date.

4. Fourth, it inserts new rows into the hr_remuneration_line table by selecting distinct data from various other tables (hr_employee, hr_contract, hr_contract_type, hr_attribute, hr_wage_type, month_hr_attribute_rel, hr_month, hr_attribute_hr_kg_payroll_configuration_rel, hr_kg_payroll_configuration, religion_hr_attribute_rel, hr_religion, hr_remuneration_line_header, hr_remuneration_line) based on certain conditions. The inserted data includes the rem_header_id, emp_id, valid_from, valid_to, code, amount, create_date, create_uid, write_uid, write_date, wage_type_id, name, attribute_id.

Overall, the query is updating hr_remuneration_line and hr_remuneration_line_header table by deleting certain rows, and inserting new rows based on data from other tables, certain conditions, and certain calculations.

Here is the flowchart for compute and compute eligible feature in remuneration.

flowchart

Input New Attribute

To input new attributes, user should go to Odoo Employee Module, and choose configuration and select the werks eligible menu.

Odoo Menu Employee Configuration Werks Eligible

1

1

In Werks Eligible, to input a new attribute, user needs to create a new Werks Eligible. Click Herefor more details. Here is the summarized flow of processing attribute in the system.

Flowchart New Attribute

info

Remember that the remuneration feature only calculate the attributes that has the same payment type as the remuneration. So the Attribute's Payment Type must be equals to Remuneration Payment Type (regular or irregular).