[IMP] hr_holidays: improve leave type form view

Purpose: according to tasks's specifications

 * place elements in order it is not changing according what you select
 * https://drive.google.com/a/odoo.com/file/d/18gat1lw8mo9NTqU3mDuXqvuZXlMRzASX/view?usp=drivesdk
 * https://drive.google.com/a/odoo.com/file/d/1fLKpnW6RcaQetYJ0Ep7vZ7YHr_pW8-x_/view?usp=drivesdk

This commit is linked to task ID 1871812 and PR #26180.
This commit is contained in:
Thibault Delavallée
2018-08-08 16:28:52 +02:00
parent 7e7ea0aa82
commit 5ee535f297
2 changed files with 17 additions and 17 deletions
+8 -8
View File
@@ -41,7 +41,7 @@ class HolidaysType(models.Model):
('wheat', 'Wheat'),
('ivory', 'Ivory')], string='Color in Report', required=True, default='red',
help='This color will be used in the leaves summary located in Reporting > Leaves by Department.')
limit = fields.Boolean('Unlimited',
limit = fields.Boolean('Exceed Allocation',
help="If you select this check box, the system will allow the employees to ask"
"for leaves without allocating some beforehand")
active = fields.Boolean('Active', default=True,
@@ -58,16 +58,16 @@ class HolidaysType(models.Model):
company_id = fields.Many2one('res.company', string='Company', default=lambda self: self.env.user.company_id)
validation_type = fields.Selection([('hr', 'Human Resource Responsible'),
('manager', 'Manager'),
validation_type = fields.Selection([('hr', 'Human Resource officer'),
('manager', 'Employee Manager'),
('both', 'Double Validation')],
default='hr',
string='Validation By')
employee_applicability = fields.Selection([('both', 'On Leave As Well As On Allocation'),
('leave', 'Only On Leave'),
('allocation', 'Only On Allocation')],
default=lambda self: 'leave' if self.limit else 'both', string='Available For Employee :',
employee_applicability = fields.Selection([('both', 'Both'),
('leave', 'Can be requested'),
('allocation', 'Can be allocated')],
default=lambda self: 'leave' if self.limit else 'both', string='Mode',
help='This leave type will be available on Leave / Allocation request based on selected value')
validity_start = fields.Date("Start Date", default=fields.Date.today,
@@ -84,7 +84,7 @@ class HolidaysType(models.Model):
('half', 'Half-day'),
('hour', 'Hours')], default='day', string='Take Leaves in', required=True)
accrual = fields.Boolean('Is Accrual', default=False,
accrual = fields.Boolean('Accrual', default=False,
help='This option forces this type of leave to be allocated accrually')
unpaid = fields.Boolean('Is Unpaid', default=False)
@@ -34,25 +34,25 @@
<field name="sequence" attrs="{'invisible': [('limit', '!=', False)]}" groups="base.group_no_one"/>
<field name="time_type" groups="base.group_no_one"/>
</group>
<group name="allocation_request" string="Allocation" attrs="{'invisible': [('unpaid', '=', True)]}">
<field name="accrual"/>
<field name="negative" attrs="{'invisible': [('accrual', '=', False)]}"/>
<field name="balance_limit" attrs="{'invisible': [('accrual', '=', False)]}"/>
</group>
<group name="validation" string="Validation">
<field name="validation_type" widget="radio"/>
</group>
<group name="visibility" string="Visibility">
<field name="employee_applicability" widget="radio" attrs="{'readonly': ['|', ('limit', '=', True), ('accrual', '=', True)]}" force_save="1"/>
</group>
<group name="calendar" string="Calendar">
<group name="validity" string="Validity" attrs="{'invisible': [('employee_applicability', '=', 'allocation')]}">
<field name="validity_start"/>
<field name="validity_stop"/>
</group>
<group name="calendar" string="Calendar" groups="base.group_no_one">
<field name="categ_id"/>
<field name="color_name"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<group name="validity" string="Validity" attrs="{'invisible': [('employee_applicability', '=', 'allocation')]}">
<field name="validity_start"/>
<field name="validity_stop"/>
<group name="allocation_request" string="Allocation Type" attrs="{'invisible': [('unpaid', '=', True)]}">
<field name="accrual"/>
<field name="negative" attrs="{'invisible': [('accrual', '=', False)]}"/>
<field name="balance_limit" attrs="{'invisible': [('accrual', '=', False)]}"/>
</group>
</group>
</sheet>