[IMP] hr_contract: Add a access right group on contracts
Some private information are on the contracts. Add a special group to display the contracts, independant of the other HR access rights.
This commit is contained in:
@@ -412,7 +412,7 @@ class ResPartner(models.Model):
|
||||
'It is set either if there\'s not at least an unreconciled debit and an unreconciled credit '
|
||||
'or if you click the "Done" button.')
|
||||
invoice_ids = fields.One2many('account.invoice', 'partner_id', string='Invoices', readonly=True, copy=False)
|
||||
contract_ids = fields.One2many('account.analytic.account', 'partner_id', string='Contracts', readonly=True)
|
||||
contract_ids = fields.One2many('account.analytic.account', 'partner_id', string='Partner Contracts', readonly=True)
|
||||
bank_account_count = fields.Integer(compute='_compute_bank_count', string="Bank")
|
||||
trust = fields.Selection([('good', 'Good Debtor'), ('normal', 'Normal Debtor'), ('bad', 'Bad Debtor')], string='Degree of trust you have in this debtor', default='normal', company_dependent=True)
|
||||
invoice_warn = fields.Selection(WARNING_MESSAGE, 'Invoice', help=WARNING_HELP, default="no-message")
|
||||
|
||||
@@ -19,9 +19,11 @@ You can assign several contracts per employee.
|
||||
'website': 'https://www.odoo.com/page/employees',
|
||||
'depends': ['hr'],
|
||||
'data': [
|
||||
'security/security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'data/hr_contract_data.xml',
|
||||
'views/hr_contract_views.xml',
|
||||
'views/res_users_views.xml',
|
||||
],
|
||||
'demo': [],
|
||||
'installable': True,
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import hr_contract
|
||||
from . import res_users
|
||||
|
||||
@@ -19,7 +19,7 @@ class Employee(models.Model):
|
||||
vehicle = fields.Char(string='Company Vehicle', groups="hr.group_hr_user")
|
||||
vehicle_distance = fields.Integer(
|
||||
string='Home-Work Dist.', help="In kilometers", groups="hr.group_hr_user")
|
||||
contract_ids = fields.One2many('hr.contract', 'employee_id', string='Contracts')
|
||||
contract_ids = fields.One2many('hr.contract', 'employee_id', string='Employee Contracts')
|
||||
contract_id = fields.Many2one('hr.contract', compute='_compute_contract_id', string='Current Contract', help='Latest contract of the employee')
|
||||
contracts_count = fields.Integer(compute='_compute_contracts_count', string='Contract Count')
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResUsers(models.Model):
|
||||
_inherit = 'res.users'
|
||||
|
||||
group_hr_contract_user = fields.Selection(
|
||||
selection=lambda self: self._get_group_selection('base.module_category_hr_contract'),
|
||||
string='Contracts', compute='_compute_groups_id', inverse='_inverse_groups_id',
|
||||
category_xml_id='base.module_category_hr_contract')
|
||||
@@ -2,7 +2,5 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_hr_resource_manager,hr.employee.resource.manager,resource.model_resource_resource,hr.group_hr_manager,1,1,1,1
|
||||
access_hr_resource_calendar_user,hr.employee.resource.calendar.user,resource.model_resource_calendar,hr.group_hr_user,1,1,1,1
|
||||
access_hr_resource_calendar_attendance_user,hr.employee.resource.calendar.attendance.user,resource.model_resource_calendar_attendance,hr.group_hr_user,1,1,1,1
|
||||
access_hr_contract_type_manager,hr.contract.type.manager,model_hr_contract_type,hr.group_hr_manager,1,1,1,1
|
||||
access_hr_contract_manager,hr.contract.manager,model_hr_contract,hr.group_hr_manager,1,1,1,1
|
||||
access_hr_contract_type_user,hr.contract.type.user,model_hr_contract_type,hr.group_hr_user,1,0,0,0
|
||||
access_hr_contract_user,hr.contract.user,model_hr_contract,hr.group_hr_user,1,0,0,0
|
||||
access_hr_contract_type_manager,hr.contract.type.manager,model_hr_contract_type,hr_contract.group_hr_contract_manager,1,1,1,1
|
||||
access_hr_contract_manager,hr.contract.manager,model_hr_contract,hr_contract.group_hr_contract_manager,1,1,1,1
|
||||
|
||||
|
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<record id="hr_contract.group_hr_contract_manager" model="res.groups">
|
||||
<field name="name">Manager</field>
|
||||
<field name="category_id" ref="base.module_category_hr_contract"/>
|
||||
<field name="users" eval="[(4, ref('base.user_root'))]"/>
|
||||
</record>
|
||||
|
||||
<record id="base.default_user" model="res.users">
|
||||
<field name="groups_id" eval="[(4,ref('hr_contract.group_hr_contract_manager'))]"/>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -279,7 +279,7 @@
|
||||
action="action_hr_contract"
|
||||
parent="hr.menu_hr_root"
|
||||
sequence="4"
|
||||
groups="hr.group_hr_manager"/>
|
||||
groups="hr_contract.group_hr_contract_manager"/>
|
||||
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
<record id="res_users_view_form" model="ir.ui.view">
|
||||
<field name="name">res.users.form.hr_contract.inherit</field>
|
||||
<field name="model">res.users</field>
|
||||
<field name="inherit_id" ref="base.view_users_form"/>
|
||||
<field name="priority">51</field>
|
||||
<field name="arch" type="xml">
|
||||
<group name="applications" position="inside">
|
||||
<field name='group_hr_contract_user'/>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -5,7 +5,7 @@
|
||||
<record id="group_hr_payroll_user" model="res.groups">
|
||||
<field name="name">Officer</field>
|
||||
<field name="category_id" ref="base.module_category_hr_payroll"/>
|
||||
<field name="implied_ids" eval="[(4, ref('hr.group_hr_user'))]"/>
|
||||
<field name="implied_ids" eval="[(4, ref('hr.group_hr_user')), (4, ref('hr_contract.group_hr_contract_manager'))]"/>
|
||||
</record>
|
||||
|
||||
<record id="group_hr_payroll_manager" model="res.groups">
|
||||
|
||||
@@ -72,6 +72,12 @@
|
||||
<field name="sequence">10</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.module.category" id="module_category_hr_contract">
|
||||
<field name="name">Contracts</field>
|
||||
<field name="description">Helps you manage your contracts.</field>
|
||||
<field name="sequence">10</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.module.category" id="module_category_hr_recruitment">
|
||||
<field name="name">Recruitment</field>
|
||||
<field name="description">Helps you manage your recruitments.</field>
|
||||
|
||||
Reference in New Issue
Block a user