Hyper Open Edge Cloud

How To Create Pay Sheets per Country

showing how to define parameters specific to a country, company, group or single employee.
  • Last Update:2016-06-29
  • Version:001
  • Language:en

ERP5 Pay Sheet have changed and now use a Pay Sheet Model. A Pay Sheet Model permits to define some parameters specific to a country, a company, employee group, or a single employee. It's used to describe the common parts in several pay sheets and the method to calculate the elements. It could be applied on many employees or just on one. The model makes easy to create slices, constants, payment conditions or annotations and modify the values if they change. This module has been developed to ease the work of accounting when the laws (and therefore the calculations) are changing and to have the least possible modification of the source code. It can also generate the Pay Sheet of a group of employees from the same model.

Table of Contents

Steps

In calculating the paysheet, many elements depend on the legislation of the concerned country. That is why it was chosen to separate the initial Business Template (bt) in several bt's:

  • A generic bt, which contains no information of specific legislation: erp5_payroll
  • A bt for each legislation with the specific data used by it (e.g. : erp5_payroll_l10n_fr for France),
  • A bt for each project containing the datas used by this project (payroll services, organisations, ...), (e.g. : nexedi_payroll for Nexedi project).

Specifically, the informations that may vary from one country to another are as follow:

  • the slices,
  • the Delivery Builder (pay_sheet_transaction_builder)
  • /!\ add here the future things...

The informations that vary from one project to another are as follow :

  • the payroll services,
  • the organizations (used in payroll service),
  • the Rules (Invoice Transaction Rule)
  • the categories including :
    • the slices (salary_range category),
    • the employees grades (grade category),
    • tax_category can be added to have more part than employer and employee (tax_category category).

Create a Business Template for my country

If you need slices to calculate pay sheets in your country (general case), create a category (in the 'portal_categories' module) for your country. In this category, you will create sub categories :

You must create as categories as different amount slice you have. (more explaination in 'Create Payroll Services').

After that, create a bt for your country (respecting the naming convention so call it erp5_payroll_l10n_YourCountryCode e.g. : 'erp5_payroll_l10n_fr' for France). Add slices used for pay sheets in your country in the 'Paths' LinesField of the bt.

Create a Business Template for my project

Create Payroll Services

You must create as many Payroll Service as there are contributions on pay sheets to create : a line of pay sheets = a payroll service. In the payroll service, some parts are important and new :

  • The Base Participation it's an amount type list. It's used to define the amount group this contribution belongs to. A contribution can belong to several amounts:
    • The base salary contributes to the Gross Salary and to the Base Salary groups (because the gross salary is composed by the base salary + the bonus) . Also a bonus contributes to Gross Salary and Bonus groups. But a tax generally contribute only to deductible or non-deductible taxes group.
    • Variation Base permit to select the base categories which will help define the rules for calculating the payroll service. I recommend always select tax_category and salary_range which will allow you respectively to select the parts (employer, employee, etc.) and the slices used.
  • After your Variation Base selection, you must save your data to see the Variation Range.
  • Variation Range permits to select the slices and parts used. Normally, there is no yet slices, you must add the one you want to use. To do this go to 'portal_categories/salary_range' and create slices. A Slice is composed by a min and a max value, so you must create as categories as min an max values (but min and max values are not entered here. I'll explain that later).

e.g : In France, a lot of contributions used this 3 slices :

0     <= Tranche A < 2682
2682  <= Tranche B < 10728
10728 <= Tranche C < 21456

So we are going to create 3 categories : 'Tranche A', 'Tranche B', 'Tranche C'. (Adapt it to your legislation).

Repeat this process for all the slices required to calculate all your paysheet. I recommend that you create a generic slice (call it 'infinty_slice' for example) that you add to each of your services that do not use slices. Later, you will define value from 0 to a very big number for this slice, which will remains the same as if there were no slice, but simplifies the operations of the program. When you have all slice you need, continue creating your Payroll Service by selecting the slices used for this contribution and the different parts (Employer Share, Employee Share, ...).

Create Portal Rules

Go to 'http://yourInstanceAddress/portal_rules' and add a new Invoice Transaction Rule. Call it 'default_pay_sheet_transaction_rule'. Then add the Predicate and configure the behavior for the different shares and services.

Add Employees Grade

If your company use grade, it may be a good idea to add the different grade category in 'portal_categories/grade'. That will permit to use a predicate to apply a paysheet model only on a certain grade.

Create the new Business Template

Then, create a new bt for your project (call it YourProjectName_payroll e.g.: 'nexedi_payroll'), see HowToCreateBusinessTemplates for help. Now you are ready to follow the next HowTo : HowToCreatePaySheet.

Principles of Inheritance(from notes)

A new concept that make the new Payroll module very more usable is the Inheritance principle :

A PaySheet inherits from a model, and this model could inherit from some other models wich could inherit from other models ... In a company, this permit to seperate contributions who are applied in certain condition (eg. for a precise employee group), this could be representated with the following schema :

ERP5 Paysheet Inheritance Flowchart

Create a Pay Sheet Model

In first, you must install the 'erp5_payroll' Business Template, and the corresponding localized Business Template (e.g. : 'erp5_payroll_l10n_fr' for France), if it does not exist, it is recommended to create it by using the following tutorial: HowToMyCountryPaySheet. After installing the 'erp5_payroll' and localized Business template, the first step is to create a model.

Add Pay Sheet Model

Go to the Pay Sheet Model Module and 'add Pay Sheet Model' from the action menu and filled the fields.

ERP5 Screenshot Paysheet Model View

The employer, employee and currency will be copied in the pay sheet if those here are empty. If Absolute Payment Date is filled, it will create a Payment Condition with it. The Work Duration Unit and Work Duration are used to indicate the worked time for this period. An Annotation Line is created, when these fields are filled. Annotation Lines are designed to display informations on pay sheets, but at the moment they are not yet used in the rendering of it. Settings Categories are the base categories used to create the slices. It corresponds more or less to the laws of that model. A country contain only slices categories used in this particular country. It is possible to add a category and the slices for your country or category for your business. To do this, go to the 'portal_categories' module and add sub-categories in the salary_range category. When this first page is filled, save your data.

Select Categories

After that, if you selected something in the Settings Categories you must see new lines in the Settings Slice tab.

ERP5 Screenshot Paysheet Settings

These new lines correspond to slices that it is now possible to use. You must define a minimum and maximum value for each of the ones you want to use. The slices objects are created when you save. If you want, you could now add some Annotation Lines, Payment Conditions or Ratio Settings but it's not necessary for a minimal Pay Sheet Model.

Add Model Lines

After completing the fields of the model, we must add Model Lines representing the contributions that you want to appear on the pay sheet. To add a Model Line, use 'Add Model Line' from action menu.

ERP5 Screenshot Paysheet Model Line

Now You must select the Payroll Service corresponding to the contribution you want to add. If it doesn't exists, add it (don't forget to select slices in variation range if you want to use slices with this contribution). The Service Provider is the organization who collects the tax (a contribution is generally the payment of a service, social or otherwise..., it's this organization account that will be used in the accounting calculations). If the Editable check box is checked, that's mean that the amount/percentage will be (re)asked at the calculation step. This permits to use a same model with many employees although some values vary from one employee to another.

The Base Application is used to set the amount on which the contribution will be applied.

e.g. : We have a contribution called "old age insurance" wich is 6.55 percent of the gross_salary for the employee and 8.20 percent of the gross_salary for employer. To represent this contribution, we can create a new Model Line and filled Title, Payroll Service and Service Provider. In the Base Application List Field, we select 'Base Salary' and 'Bonus' because the gross salary is composed by this two elements. In the Variation Parallel List Field, we select the good slice and the good shares (here it's 'Employer Share' and 'Employee Share'). After saving, a matrixbox should appear on the bottom, here, we can fill the two fields 'Percentage' of the 'Employee Share' and 'Employer Share' with the 6.55 and 8.20 values. This mean, this contribution will be 6.55% of the gross salary for employees and 8.20% for employer.

If the contribution that you are adding is applied to nothing (such as salary, for example) do not select anything. The amounts of the Base Application are determined at the calculation step with selected categories in the Base Participation list in the Payroll Services. When this is done, save your data. If your Payroll Service has slices selected in the variation range, you must now see those same variations that can be used for this contribution. Select the ones you want, and save.

After this, you must see some new lines at the bottom of the page. This ones corresponds to rate or share to applied in this slice. If your contribution depend on a percentage of an amount, just fill in the 'percentage', if the contribution is an amount, fill just the first column.

Now your first model line is created. I recommend to add others, such as one concerning the salary (and whose Base Participation of Payroll Service is base_salary) if no service with the base the contributions apply to is used, then the amount of pay sheet lines likely to be null.

Set Conditions

After completing and registered your line model, you can, in the 'Predicate' tab, define the conditions in which this contribution will be applied.

ERP5 Screenshot Paysheet Predicate View

This allows, for example, to use the same model for one company, with a predicate for director, worker and engineers. If this contribution have a predicate with just Worker, that's mean, at the moment of the calculation, only person with grade 'Worker' will have this contribution applied.

Create a Pay Sheet Transaction

Add Transaction

Go to the Accounting Module and 'add Pay Sheet Transaction' from the action menu and filled the fields.

ERP5 Screenshot Paysheet Transaction View

If you have well completed your model, you do not have a lot of fields to be filled, only the title, start/end work period and the model you want to use are needed. Once these fields are completed and saved, you can use the function 'Apply Pay Sheet Model' from the action menu, which would fill in the missing fields and copy the sub objects in the model (such as Annotation Lines) in the payroll. If everything looks correct, then you can start the calculation with the 'Calculation of the Pay Sheet Transaction' from the Action menu. After this, if you have check some editable check boxes, the corresponding value will be requested, after filled them, click on 'Calculate The Pay Sheet Transaction' to have the pay sheet lines.

Related Articles