@@ -36,6 +36,7 @@ class GoApprovals(models.Model):
|
||||
active = fields.Boolean('Active', default=True, tracking=True)
|
||||
work_end = fields.Boolean(string="结束")
|
||||
is_day = fields.Boolean(string="按天")
|
||||
is_half = fields.Boolean(string="按半天")
|
||||
is_hour = fields.Boolean(string="按小时")
|
||||
start_day_selection = fields.Selection([('half', '上半天'),('afternoon', '下半天')], string="天")
|
||||
end_day_selection = fields.Selection([('half', '上半天'), ('afternoon', '下半天')], string="天")
|
||||
@@ -47,11 +48,6 @@ class GoApprovals(models.Model):
|
||||
|
||||
name_title = fields.Char(default=_get_default_name_title)
|
||||
|
||||
@api.onchange('is_day', 'is_hour')
|
||||
def _onchange_role_selection(self):
|
||||
if self.is_day and self.is_hour:
|
||||
raise UserError("只能选择按天或按小时")
|
||||
|
||||
@api.onchange('start_day_selection', 'end_day_selection')
|
||||
def _onchange_selection_fields(self):
|
||||
for record in self:
|
||||
@@ -104,4 +100,25 @@ class GoApprovals(models.Model):
|
||||
else:
|
||||
record.days = 0
|
||||
|
||||
@api.onchange('is_day')
|
||||
def _onchange_is_day(self):
|
||||
if self.is_day:
|
||||
self.is_half = False
|
||||
self.is_hour = False
|
||||
|
||||
@api.onchange('is_half')
|
||||
def _onchange_is_half(self):
|
||||
if self.is_half:
|
||||
self.is_day = False
|
||||
self.is_hour = False
|
||||
|
||||
@api.onchange('is_hour')
|
||||
def _onchange_is_hour(self):
|
||||
if self.is_hour:
|
||||
self.is_day = False
|
||||
self.is_half = False
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -52,24 +52,33 @@
|
||||
<group>
|
||||
<field name="users_id" invisible="1"/>
|
||||
<field name="is_day"/>
|
||||
<field name="is_half"/>
|
||||
<field name="is_hour"/>
|
||||
<field name="days" invisible="not is_day"/>
|
||||
<field name="hours" invisible="not is_hour"/>
|
||||
<field name="work_end" invisible="1"/>
|
||||
</group>
|
||||
<group col="2">
|
||||
<group>
|
||||
<field name="statr_date" invisible="not is_day"/>
|
||||
<field name="end_date" invisible="not is_day"/>
|
||||
<field name="statr_date" invisible="not (is_day or is_half)"/>
|
||||
<field name="end_date" invisible="not (is_day or is_half)"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="start_day_selection" invisible="not is_day" string=" "/>
|
||||
<field name="end_day_selection" invisible="not is_day" string=" "/>
|
||||
<field name="start_day_selection" invisible="not is_half" string=" " widget="redio"/>
|
||||
<field name="end_day_selection" invisible="not is_half" string=" " widget="redio"/>
|
||||
</group>
|
||||
</group>
|
||||
<group col="3">
|
||||
<group>
|
||||
<field name="date_start" invisible="not is_hour"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="date_end" invisible="not is_hour"/>
|
||||
<group>
|
||||
</group>
|
||||
<field name="hours" invisible="not is_hour"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<field name="date_start" invisible="not is_hour"/>
|
||||
<field name="date_end" invisible="not is_hour"/>
|
||||
<field name="reason_application"/>
|
||||
<field name="documents_ids" widget="preview_many2many"/>
|
||||
</group>
|
||||
|
||||
Reference in New Issue
Block a user