diff options
| author | RomainLibert <rli@odoo.com> | 2018-11-26 15:58:44 +0000 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2018-12-18 15:03:27 +0000 |
| commit | 939f8e05347e2a07bf2639b652c7deaa6c00c837 (patch) | |
| tree | 7eb150a9b626dbf63bab968ede106f56cf36cbdf | |
| parent | d5fd84b89a51ef41ca0aa13cf7acc94e684d40ce (diff) | |
[IMP] hr_payroll: add legal information to payslip report
This commit adds two fields:
- compute_date on payslip (set once computed)
- registration_number on employee (used to identify the
employee)
These fields are displayed in the payslip_report
It also adds the worked_days to the same report
These fields are a legal obligation in some countries (like Belgium)
| -rw-r--r-- | addons/hr_payroll/models/hr_employee.py | 6 | ||||
| -rw-r--r-- | addons/hr_payroll/models/hr_payslip.py | 3 | ||||
| -rw-r--r-- | addons/hr_payroll/views/hr_employee_views.xml | 10 | ||||
| -rw-r--r-- | addons/hr_payroll/views/report_payslip_templates.xml | 52 | ||||
| -rw-r--r-- | addons/hr_payroll_account/__manifest__.py | 1 | ||||
| -rw-r--r-- | addons/l10n_be_hr_payroll/__manifest__.py | 1 |
6 files changed, 64 insertions, 9 deletions
diff --git a/addons/hr_payroll/models/hr_employee.py b/addons/hr_payroll/models/hr_employee.py index 4570063ad91..2521c227a6c 100644 --- a/addons/hr_payroll/models/hr_employee.py +++ b/addons/hr_payroll/models/hr_employee.py @@ -14,6 +14,12 @@ class HrEmployee(models.Model): slip_ids = fields.One2many('hr.payslip', 'employee_id', string='Payslips', readonly=True) payslip_count = fields.Integer(compute='_compute_payslip_count', string='Payslip Count', groups="hr_payroll.group_hr_payroll_user") + registration_number = fields.Char('Registration Number of the Employee', copy=False) + + _sql_constraints = [ + ('unique_registration_number', 'UNIQUE(registration_number, company_id)', 'No duplication of registration numbers is allowed') + ] + @api.multi def _compute_payslip_count(self): for employee in self: diff --git a/addons/hr_payroll/models/hr_payslip.py b/addons/hr_payroll/models/hr_payslip.py index d902987c3e2..626d84c9414 100644 --- a/addons/hr_payroll/models/hr_payslip.py +++ b/addons/hr_payroll/models/hr_payslip.py @@ -66,6 +66,7 @@ class HrPayslip(models.Model): payslip_run_id = fields.Many2one('hr.payslip.run', string='Payslip Batches', readonly=True, copy=False, states={'draft': [('readonly', False)]}) payslip_count = fields.Integer(compute='_compute_payslip_count', string="Payslip Computation Details") + compute_date = fields.Date('Computed On') @api.multi def _compute_payslip_count(self): @@ -143,7 +144,7 @@ class HrPayslip(models.Model): contracts = payslip.contract_id or \ payslip.employee_id._get_contracts(payslip.date_from, payslip.date_to) lines = [(0, 0, line) for line in payslip._get_payslip_lines(contracts)] - payslip.write({'line_ids': lines, 'number': number, 'state': 'verify'}) + payslip.write({'line_ids': lines, 'number': number, 'state': 'verify', 'compute_date': fields.Date.today()}) return True @api.model diff --git a/addons/hr_payroll/views/hr_employee_views.xml b/addons/hr_payroll/views/hr_employee_views.xml index 20b765e6910..85e289719d9 100644 --- a/addons/hr_payroll/views/hr_employee_views.xml +++ b/addons/hr_payroll/views/hr_employee_views.xml @@ -1,13 +1,12 @@ <?xml version="1.0" encoding="utf-8"?> <odoo> - <!-- Employee View --> <record id="payroll_hr_employee_view_form" model="ir.ui.view"> <field name="name">payroll.hr.employee.view.form</field> <field name="model">hr.employee</field> <field name="inherit_id" ref="hr.view_employee_form"/> <field name="arch" type="xml"> - <button name="toggle_active" position="before"> + <xpath expr="//button[@name='toggle_active']" position="before"> <button name="%(act_hr_employee_payslip_list)d" class="oe_stat_button" icon="fa-money" @@ -15,7 +14,10 @@ groups="hr_payroll.group_hr_payroll_user"> <field name="payslip_count" widget="statinfo" string="Payslips"/> </button> - </button> + </xpath> + <xpath expr="//field[@name='user_id']" position="after"> + <field name="registration_number"/> + </xpath> </field> </record> -</odoo>
\ No newline at end of file +</odoo> diff --git a/addons/hr_payroll/views/report_payslip_templates.xml b/addons/hr_payroll/views/report_payslip_templates.xml index 876ce15de26..b968a9eb58e 100644 --- a/addons/hr_payroll/views/report_payslip_templates.xml +++ b/addons/hr_payroll/views/report_payslip_templates.xml @@ -5,8 +5,24 @@ <t t-foreach="docs" t-as="o"> <t t-call="web.external_layout"> <div class="page"> - <h2>Pay Slip</h2> - <p t-field="o.name"/> + <h2 t-field="o.name"/> + + <table class="table table-sm table-bordered"> + <tr> + <td><strong>Company Information</strong></td> + <td> + <div><span t-field="o.company_id.name"/></div> + <div><span t-field="o.company_id.street"/></div> + <div><span t-field="o.company_id.street2" t-if="o.company_id.street2"/></div> + <div> + <span t-field="o.company_id.city"/> + <span t-field="o.company_id.state_id"/> + <span t-field="o.company_id.zip"/> + </div> + <div><span t-field="o.company_id.country_id"/></div> + </td> + </tr> + </table> <table class="table table-sm table-bordered"> <tr> @@ -40,6 +56,22 @@ <td><strong>Date To</strong></td> <td><span t-field="o.date_to"/></td> </tr> + <tr> + <td><strong>Computed On</strong></td> + <td><span t-field="o.compute_date"/></td> + <td><strong>Registration Number</strong></td> + <td><span t-field="o.employee_id.registration_number"/></td> + </tr> + </table> + + <table class="table table-sm"> + <tr> + <td><strong>Basic Salary</strong></td> + <td> + <span t-esc="o.line_ids.filtered(lambda line: line.code == 'BASIC').total" + t-options='{"widget": "monetary", "display_currency": o.company_id.currency_id}'/> + </td> + </tr> </table> <table class="table table-sm"> @@ -47,21 +79,33 @@ <tr> <th>Code</th> <th>Name</th> + <th>Number of Hours</th> + <th>Number of Days</th> <th>Quantity/rate</th> <th>Amount</th> <th>Total</th> </tr> </thead> <tbody> - <tr t-foreach="o.line_ids.filtered(lambda line: line.appears_on_payslip)" t-as="line"> + <tr t-foreach="o.worked_days_line_ids" t-as="worked_days"> + <td><span t-field="worked_days.code"/></td> + <td><span t-field="worked_days.name"/></td> + <td><span t-field="worked_days.number_of_hours"/></td> + <td><span t-field="worked_days.number_of_days"/></td> + <td></td> + <td></td> + <td></td> + </tr> + <tr t-foreach="o.line_ids.filtered(lambda line: line.appears_on_payslip)" t-as="line"> <td><span t-field="line.code"/></td> <td><span t-field="line.name"/></td> + <td></td> + <td></td> <td><span t-field="line.quantity"/></td> <td><span t-esc="line.amount" t-options='{"widget": "monetary", "display_currency": o.company_id.currency_id}'/></td> <td><span t-esc="line.total" t-options='{"widget": "monetary", "display_currency": o.company_id.currency_id}'/></td> - </tr> </tbody> </table> diff --git a/addons/hr_payroll_account/__manifest__.py b/addons/hr_payroll_account/__manifest__.py index 0af1cbe0c90..fe56ebf6ffa 100644 --- a/addons/hr_payroll_account/__manifest__.py +++ b/addons/hr_payroll_account/__manifest__.py @@ -15,4 +15,5 @@ Generic Payroll system Integrated with Accounting. 'data': ['views/hr_payroll_account_views.xml'], 'demo': ['data/hr_payroll_account_demo.xml'], 'test': ['../account/test/account_minimal_test.xml'], + 'auto_install': True, } diff --git a/addons/l10n_be_hr_payroll/__manifest__.py b/addons/l10n_be_hr_payroll/__manifest__.py index 1c6d178f8a4..5a1f5c00865 100644 --- a/addons/l10n_be_hr_payroll/__manifest__.py +++ b/addons/l10n_be_hr_payroll/__manifest__.py @@ -25,4 +25,5 @@ Belgian Payroll Rules. 'data/l10n_be_hr_payroll_data.xml', 'views/res_config_settings_views.xml', ], + 'auto_install': True, } |
