mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Initial commit of hr_workers_comp and hr_workers_comp_payroll for 11.0
This commit is contained in:
1
hr_workers_comp/__init__.py
Executable file
1
hr_workers_comp/__init__.py
Executable file
@@ -0,0 +1 @@
|
|||||||
|
from . import contract
|
||||||
22
hr_workers_comp/__manifest__.py
Executable file
22
hr_workers_comp/__manifest__.py
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
'name': 'Workers\' Compensation Class',
|
||||||
|
'author': 'Hibou Corp. <hello@hibou.io>',
|
||||||
|
'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
|
||||||
|
}
|
||||||
25
hr_workers_comp/contract.py
Normal file
25
hr_workers_comp/contract.py
Normal file
@@ -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)
|
||||||
73
hr_workers_comp/contract_views.xml
Normal file
73
hr_workers_comp/contract_views.xml
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<record id="wc_code_view_tree" model="ir.ui.view">
|
||||||
|
<field name="name">hr.wc_code.tree</field>
|
||||||
|
<field name="model">hr.wc_code</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="Workers Compensation Codes">
|
||||||
|
<field name="code"/>
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="rate"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="wc_code_view_form" model="ir.ui.view">
|
||||||
|
<field name="name">hr.wc_code.form</field>
|
||||||
|
<field name="model">hr.wc_code</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Workers Compensation Code">
|
||||||
|
<sheet>
|
||||||
|
<group>
|
||||||
|
<group>
|
||||||
|
<field name="active"/>
|
||||||
|
<field name="code"/>
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="rate"/>
|
||||||
|
</group>
|
||||||
|
<group name="other"/>
|
||||||
|
</group>
|
||||||
|
</sheet>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="wc_code_view_search" model="ir.ui.view">
|
||||||
|
<field name="name">hr.wc_code.search</field>
|
||||||
|
<field name="model">hr.wc_code</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<search string="Workers Compensation Search">
|
||||||
|
<field name="code"/>
|
||||||
|
<field name="name"/>
|
||||||
|
</search>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="wc_code_action_main" model="ir.actions.act_window">
|
||||||
|
<field name="name">Workers Compensation Codes</field>
|
||||||
|
<field name="res_model">hr.wc_code</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<field name="help" type="html">
|
||||||
|
<p>
|
||||||
|
No codes
|
||||||
|
</p>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<menuitem id="wc_code_menu_main" name="Workers Comp. Codes"
|
||||||
|
action="wc_code_action_main"
|
||||||
|
sequence="20" parent="hr.menu_human_resources_configuration"/>
|
||||||
|
|
||||||
|
<!-- Inherited -->
|
||||||
|
<record id="hr_contract_view_form_inherit" model="ir.ui.view">
|
||||||
|
<field name="name">hr.contract.form.inherit</field>
|
||||||
|
<field name="model">hr.contract</field>
|
||||||
|
<field name="inherit_id" ref="hr_contract.hr_contract_view_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='type_id']" position="after">
|
||||||
|
<field name="wc_code_id"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
3
hr_workers_comp/ir.model.access.csv
Normal file
3
hr_workers_comp/ir.model.access.csv
Normal file
@@ -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
|
||||||
|
1
hr_workers_comp_payroll/__init__.py
Executable file
1
hr_workers_comp_payroll/__init__.py
Executable file
@@ -0,0 +1 @@
|
|||||||
|
from . import payslip
|
||||||
21
hr_workers_comp_payroll/__manifest__.py
Executable file
21
hr_workers_comp_payroll/__manifest__.py
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
'name': 'Workers\' Compensation Class - Payroll',
|
||||||
|
'author': 'Hibou Corp. <hello@hibou.io>',
|
||||||
|
'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
|
||||||
|
}
|
||||||
8
hr_workers_comp_payroll/payslip.py
Normal file
8
hr_workers_comp_payroll/payslip.py
Normal file
@@ -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)
|
||||||
14
hr_workers_comp_payroll/payslip_views.xml
Normal file
14
hr_workers_comp_payroll/payslip_views.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<!-- Inherited -->
|
||||||
|
<record id="view_hr_payslip_form_inherit" model="ir.ui.view">
|
||||||
|
<field name="name">hr.payslip.form.inherit</field>
|
||||||
|
<field name="model">hr.payslip</field>
|
||||||
|
<field name="inherit_id" ref="hr_payroll.view_hr_payslip_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='contract_id']" position="after">
|
||||||
|
<field name="contract_wc_code_id" readonly="1"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user