diff --git a/hr_workers_comp/__init__.py b/hr_workers_comp/__init__.py new file mode 100755 index 00000000..99a5468a --- /dev/null +++ b/hr_workers_comp/__init__.py @@ -0,0 +1 @@ +from . import contract diff --git a/hr_workers_comp/__manifest__.py b/hr_workers_comp/__manifest__.py new file mode 100755 index 00000000..55599c5c --- /dev/null +++ b/hr_workers_comp/__manifest__.py @@ -0,0 +1,22 @@ +{ + 'name': 'Workers\' Compensation Class', + 'author': 'Hibou Corp. ', + 'license': 'AGPL-3', + 'category': 'Human Resources', + 'depends': ['hr_contract'], + 'version': '11.0.0.0.0', + 'description': """ +Workers' Compensation Class +=========================== + +Provides a model to keep track of Workers' Comp. Class Codes and Rates. + """, + + 'auto_install': False, + 'website': 'https://hibou.io/', + 'data':[ + 'ir.model.access.csv', + 'contract_views.xml', + ], + 'installable': True +} diff --git a/hr_workers_comp/contract.py b/hr_workers_comp/contract.py new file mode 100644 index 00000000..fb27536c --- /dev/null +++ b/hr_workers_comp/contract.py @@ -0,0 +1,25 @@ +from odoo import api,fields,models + + +class HRContract(models.Model): + _inherit = 'hr.contract' + + wc_code_id = fields.Many2one('hr.wc_code', string='Workers Comp. Code') + + +class WorkersCompensationClass(models.Model): + _name = 'hr.wc_code' + _description = "Workers Comp. Code" + _rec_name = 'display_name' + _order = 'code' + + active = fields.Boolean('Active', default=True) + name = fields.Char('Name') + code = fields.Char('Code') + rate = fields.Float('Rate', digits=(7, 6), company_dependent=True) + display_name = fields.Char(compute='_compute_clean_display_name', store=True) + + @api.depends('name', 'code') + def _compute_clean_display_name(self): + for rec in self: + rec.display_name = '%s %s' % (rec.code, rec.name) diff --git a/hr_workers_comp/contract_views.xml b/hr_workers_comp/contract_views.xml new file mode 100644 index 00000000..81e7e6d9 --- /dev/null +++ b/hr_workers_comp/contract_views.xml @@ -0,0 +1,73 @@ + + + + hr.wc_code.tree + hr.wc_code + + + + + + + + + + + hr.wc_code.form + hr.wc_code + +
+ + + + + + + + + + + +
+
+
+ + + hr.wc_code.search + hr.wc_code + + + + + + + + + + Workers Compensation Codes + hr.wc_code + form + tree,form + +

+ No codes +

+
+
+ + + + + + hr.contract.form.inherit + hr.contract + + + + + + + +
\ No newline at end of file diff --git a/hr_workers_comp/ir.model.access.csv b/hr_workers_comp/ir.model.access.csv new file mode 100644 index 00000000..a3be149a --- /dev/null +++ b/hr_workers_comp/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_hr_wc_code,access_hr_wc_code,model_hr_wc_code,base.group_user,1,0,0,0 +manage_hr_hr_wc_code,manage_hr_hr_wc_code,model_hr_wc_code,hr.group_hr_user,1,1,1,1 \ No newline at end of file diff --git a/hr_workers_comp_payroll/__init__.py b/hr_workers_comp_payroll/__init__.py new file mode 100755 index 00000000..305e17f9 --- /dev/null +++ b/hr_workers_comp_payroll/__init__.py @@ -0,0 +1 @@ +from . import payslip diff --git a/hr_workers_comp_payroll/__manifest__.py b/hr_workers_comp_payroll/__manifest__.py new file mode 100755 index 00000000..2ccbb78d --- /dev/null +++ b/hr_workers_comp_payroll/__manifest__.py @@ -0,0 +1,21 @@ +{ + 'name': 'Workers\' Compensation Class - Payroll', + 'author': 'Hibou Corp. ', + 'license': 'AGPL-3', + 'category': 'Human Resources', + 'depends': ['hr_contract'], + 'version': '11.0.0.0.0', + 'description': """ +Workers' Compensation Class - Payroll +===================================== + +Links Payslips with Contract's WC Codes. Useful for reporting and grouping payslips. +Salary Rules can now make use of the Workers Comp code and rate. + """, + 'auto_install': True, + 'website': 'https://hibou.io/', + 'data':[ + 'payslip_views.xml', + ], + 'installable': True +} diff --git a/hr_workers_comp_payroll/payslip.py b/hr_workers_comp_payroll/payslip.py new file mode 100644 index 00000000..31833a83 --- /dev/null +++ b/hr_workers_comp_payroll/payslip.py @@ -0,0 +1,8 @@ +from odoo import api,fields,models + + +class Payslip(models.Model): + _inherit = 'hr.payslip' + + contract_wc_code_id = fields.Many2one('hr.wc_code', string='Workers Comp. Code', + related='contract_id.wc_code_id', store=True) diff --git a/hr_workers_comp_payroll/payslip_views.xml b/hr_workers_comp_payroll/payslip_views.xml new file mode 100644 index 00000000..0264404f --- /dev/null +++ b/hr_workers_comp_payroll/payslip_views.xml @@ -0,0 +1,14 @@ + + + + + hr.payslip.form.inherit + hr.payslip + + + + + + + + \ No newline at end of file