添加功能
This commit is contained in:
@@ -20,13 +20,27 @@ class InheritHrLeave(models.Model):
|
||||
is_filing = fields.Boolean(string="归档")
|
||||
application_reason = fields.Char(string="申请原因", compute="_compute_application_reason")
|
||||
|
||||
def confirm(self):
|
||||
def confirm_is_filing(self):
|
||||
leave_ids = self.env["hr.leave"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id'))
|
||||
)
|
||||
for leave in leave_ids:
|
||||
if leave:
|
||||
leave.write({'is_filing': True})
|
||||
leave.sudo().write({'is_filing': True, 'state': 'validate'})
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'display_notification',
|
||||
'params': {
|
||||
'type': 'success',
|
||||
'message': '归档成功',
|
||||
'sticky': False,
|
||||
}
|
||||
}
|
||||
|
||||
def write(self, vals):
|
||||
if set(vals.keys()) == {'is_filing'}:
|
||||
return super(InheritHrLeave, self.sudo()).write(vals)
|
||||
return super(InheritHrLeave, self).write(vals)
|
||||
|
||||
@api.depends('batch_id', 'hour_batch_id')
|
||||
def _compute_application_reason(self):
|
||||
|
||||
@@ -127,6 +127,7 @@ class YuthonVacationReports(models.Model):
|
||||
'domain': [
|
||||
('date_from', '>=', start_date),
|
||||
('date_from', '<=', end_date),
|
||||
('state', '=', 'validate'),
|
||||
('company_id', 'in', self.env.companies.ids)
|
||||
],
|
||||
'target': 'current',
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree string="请假情况" editable="bottom" limit="15" create="false" delete="false" js_class="custom_statement_confirm_button">
|
||||
<header>
|
||||
<button name="confirm" type="object" string="归档" class="oe_highlight"/>
|
||||
<button name="confirm_is_filing" type="object" string="归档" class="oe_highlight"/>
|
||||
</header>
|
||||
<field name="caption"/>
|
||||
<field name="employee_id"/>
|
||||
|
||||
Reference in New Issue
Block a user