@@ -165,6 +165,26 @@ class HrAttendance(models.Model):
|
||||
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})
|
||||
|
||||
def button_batch_correct(self):
|
||||
attendance_ids = self.env["hr.attendance"].browse(self._context.get('active_ids', self._context.get('active_id')))
|
||||
for record in attendance_ids:
|
||||
year = record.current_data.year
|
||||
month = record.current_data.month
|
||||
day = record.current_data.day
|
||||
current_date = datetime.today()
|
||||
min_hour_from = record.employee_id.resource_id.calendar_id.attendance_ids[0].hour_from
|
||||
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})
|
||||
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})
|
||||
|
||||
@api.depends('current_data')
|
||||
def _compute_week(self):
|
||||
for record in self:
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
<field name="users" eval="[(4, ref('base.user_admin'))]"/>
|
||||
</record>
|
||||
<record id="group_he_attendance_planning_manager" model="res.groups">
|
||||
<field name="name">计划考勤管理员</field>
|
||||
<field name="name">计划考勤管理员</field>
|
||||
<field name="category_id" ref="module_he_attendance_duty"/>
|
||||
<field name="implied_ids" eval="[(4, ref('group_he_attendance_customer_manager')), (4, ref('group_he_attendance_engineering_manager')),
|
||||
(4, ref('group_he_attendance_security_manager'))]"/>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<button name="button_duty_approval" type="object" string="外出" class="oe_highlight"
|
||||
invisible="not is_abnormal"/>
|
||||
<button name="button_correct_approval" type="object" string="修正" class="oe_highlight"
|
||||
invisible="not is_abnormal"/>
|
||||
invisible="not is_abnormal" groups="yuthon_hr_attendance.group_he_attendance_planning_manager"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -101,4 +101,11 @@
|
||||
<field name="context">{"search_default_employee": 1}</field>
|
||||
<field name="domain">[('employee_id.yuthon_company', '=', 'thwg')]</field>
|
||||
</record>
|
||||
<record id="action_button_batch_card" model="ir.actions.server">
|
||||
<field name="name">批量修正</field>
|
||||
<field name="model_id" ref="yuthon_hr_attendance.model_hr_attendance"/>
|
||||
<field name="binding_model_id" ref="yuthon_hr_attendance.model_hr_attendance"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.button_batch_correct()</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user