[IMP] hr,hr_contract: hide fields according to country
Hide fields related to belgian localisation when not using a belgian company. Task Id: 2496597 closes odoo/odoo#69691 Related: odoo/enterprise#17881 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
@@ -33,6 +33,8 @@ class HrEmployeePrivate(models.Model):
|
||||
user_partner_id = fields.Many2one(related='user_id.partner_id', related_sudo=False, string="User's partner")
|
||||
active = fields.Boolean('Active', related='resource_id.active', default=True, store=True, readonly=False)
|
||||
company_id = fields.Many2one('res.company',required=True)
|
||||
company_country_id = fields.Many2one('res.country', 'Company Country', related='company_id.country_id', readonly=True)
|
||||
company_country_code = fields.Char(related='company_country_id.code', readonly=True)
|
||||
# private partner
|
||||
address_home_id = fields.Many2one(
|
||||
'res.partner', 'Address', help='Enter here the private address of the employee, not the one linked to your company.',
|
||||
|
||||
@@ -90,6 +90,8 @@
|
||||
<field name="work_phone" widget="phone"/>
|
||||
<field name="work_email" widget="email"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="company_country_id" invisible="1"/>
|
||||
<field name="company_country_code" invisible="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="department_id"/>
|
||||
|
||||
@@ -44,6 +44,7 @@ class Contract(models.Model):
|
||||
company_id = fields.Many2one('res.company', compute='_compute_employee_contract', store=True, readonly=False,
|
||||
default=lambda self: self.env.company, required=True)
|
||||
company_country_id = fields.Many2one('res.country', string="Company country", related='company_id.country_id', readonly=True)
|
||||
country_code = fields.Char(related='company_country_id.code', readonly=True)
|
||||
contract_type_id = fields.Many2one('hr.contract.type', "Contract Type")
|
||||
|
||||
"""
|
||||
|
||||
@@ -36,6 +36,8 @@ class ContractHistory(models.Model):
|
||||
resource_calendar_id = fields.Many2one('resource.calendar', readonly=True)
|
||||
wage = fields.Monetary('Wage', help="Employee's monthly gross wage.", readonly=True)
|
||||
company_id = fields.Many2one('res.company', string='Company', readonly=True)
|
||||
company_country_id = fields.Many2one('res.country', string="Company country", related='company_id.country_id', readonly=True)
|
||||
country_code = fields.Char(related='company_country_id.code', readonly=True)
|
||||
currency_id = fields.Many2one(string='Currency', related='company_id.currency_id', readonly=True)
|
||||
contract_type_id = fields.Many2one('hr.contract.type', 'Contract Type', readonly=True)
|
||||
contract_ids = fields.One2many('hr.contract', string='Contracts', compute='_compute_contract_ids', readonly=True)
|
||||
|
||||
@@ -57,6 +57,8 @@
|
||||
<group>
|
||||
<group>
|
||||
<field name="contract_id" invisible="1"/>
|
||||
<field name="company_country_id" invisible="1"/>
|
||||
<field name="country_code" invisible="1"/>
|
||||
<field name="date_hired"/>
|
||||
<field name="structure_type_id"/>
|
||||
<field string="Reference Working Time" name="resource_calendar_id"/>
|
||||
|
||||
@@ -152,6 +152,7 @@
|
||||
<field name="date_start"/>
|
||||
<field name="date_end"/>
|
||||
<field name="company_country_id" invisible="1"/>
|
||||
<field name="country_code" invisible="1"/>
|
||||
<field name="structure_type_id" domain="['|', ('country_id', '=', False), ('country_id', '=', company_country_id)]"/>
|
||||
<field name="calendar_mismatch" invisible="1"/>
|
||||
<label for="resource_calendar_id"/>
|
||||
|
||||
Reference in New Issue
Block a user