添加功能
This commit is contained in:
@@ -18,6 +18,8 @@ class CardApprovals(models.Model):
|
||||
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
|
||||
employee_id = fields.Many2one(related='users_id.employee_id', string="员工")
|
||||
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
|
||||
shift_id = fields.Many2one('planning.slot', string="班次", store=True)
|
||||
shift_name = fields.Char(string="班次", related="shift_id.template_id.planning_name")
|
||||
is_issues = fields.Boolean(string='是否上会')
|
||||
related_issues_id = fields.Many2one('issue.library', string="关联议题")
|
||||
reason_application = fields.Html(string="申请事由")
|
||||
@@ -29,7 +31,7 @@ class CardApprovals(models.Model):
|
||||
@api.depends('attendance_id')
|
||||
def _compute_replacement_time(self):
|
||||
for rep in self:
|
||||
rep.replacement_time = 'all'
|
||||
rep.replacement_time = None
|
||||
if rep.attendance_id.is_early_card and not rep.attendance_id.is_late_card:
|
||||
rep.replacement_time = 'quitting'
|
||||
if rep.attendance_id.is_late_card and not rep.attendance_id.is_early_card:
|
||||
|
||||
@@ -31,7 +31,7 @@ class HrAttendance(models.Model):
|
||||
('four', '四'), ('five', '五'), ('six', '六'),
|
||||
('seven', '日')], string='星期', compute='_compute_week', store=True)
|
||||
abnormal = fields.Integer(string="异常计算")
|
||||
shift_id = fields.Many2one('planning.slot', string="班次", store=True) # ? 用哪个??
|
||||
shift_id = fields.Many2one('planning.slot', string="班次", store=True)
|
||||
shift_name = fields.Char(string="班次", related="shift_id.template_id.planning_name")
|
||||
noon_duty = fields.Datetime(string="中值")
|
||||
night_duty = fields.Datetime(string="晚值")
|
||||
@@ -132,6 +132,7 @@ class HrAttendance(models.Model):
|
||||
"context": {
|
||||
'default_attendance_id': self.id,
|
||||
'default_users_id': self.employee_id.user_id.id,
|
||||
'default_shift_id':self.shift_id.id
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,12 +158,12 @@ class HrAttendance(models.Model):
|
||||
min_hour = int(min_hour_from)
|
||||
min_minute = int(min_hour_from * 10 % min_hour_from)
|
||||
will_datetime_start = current_date.replace(year=year, month=month, day=day, hour=min_hour, minute=min_minute) - timedelta(hours=8)
|
||||
record.write({'check_in': will_datetime_start, 'is_approval': True})
|
||||
record.write({'check_in': will_datetime_start, 'is_approval': True, 'is_abnormal':False})
|
||||
max_hour_to = record.employee_id.resource_id.calendar_id.attendance_ids[-1].hour_to
|
||||
max_hour = int(max_hour_to)
|
||||
max_minute = int(max_hour_to * 10 % max_hour_to)
|
||||
will_datetime_end = current_date.replace(year=year, month=month, day=day, hour=max_hour, minute=max_minute) - timedelta(hours=8)
|
||||
record.write({'check_out': will_datetime_end, 'is_approval': True})
|
||||
record.write({'check_out': will_datetime_end, 'is_approval': True, 'is_abnormal':False })
|
||||
|
||||
def button_batch_correct(self):
|
||||
attendance_ids = self.env["hr.attendance"].browse(self._context.get('active_ids', self._context.get('active_id')))
|
||||
@@ -176,13 +177,13 @@ class HrAttendance(models.Model):
|
||||
min_minute = int(min_hour_from * 10 % min_hour_from)
|
||||
will_datetime_start = current_date.replace(year=year, month=month, day=day, hour=min_hour,
|
||||
minute=min_minute) - timedelta(hours=8)
|
||||
record.write({'check_in': will_datetime_start, 'is_approval': True})
|
||||
record.write({'check_in': will_datetime_start, 'is_approval': True, 'is_abnormal':False})
|
||||
max_hour_to = record.employee_id.resource_id.calendar_id.attendance_ids[-1].hour_to
|
||||
max_hour = int(max_hour_to)
|
||||
max_minute = int(max_hour_to * 10 % max_hour_to)
|
||||
will_datetime_end = current_date.replace(year=year, month=month, day=day, hour=max_hour,
|
||||
minute=max_minute) - timedelta(hours=8)
|
||||
record.write({'check_out': will_datetime_end, 'is_approval': True})
|
||||
record.write({'check_out': will_datetime_end, 'is_approval': True, 'is_abnormal':False})
|
||||
|
||||
@api.depends('current_data')
|
||||
def _compute_week(self):
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<field name="name" required="1" placeholder="请输入标题"/>
|
||||
</h1>
|
||||
</div>
|
||||
<group string="个人信息" col="3">
|
||||
<group string="个人信息" col="4">
|
||||
<group>
|
||||
<field name="users_id"/>
|
||||
<field name="employee_id" invisible="1"/>
|
||||
@@ -32,7 +32,11 @@
|
||||
<field name="attendance_id" domain="[('employee_id', '=', employee_id), ('is_abnormal', '=', 1)]"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="replacement_time"/>
|
||||
<field name="replacement_time" readonly='0'/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="shift_id" invisible="1"/>
|
||||
<field name="shift_name"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="审批事项">
|
||||
|
||||
Reference in New Issue
Block a user