@@ -76,7 +76,7 @@ class BusController(Controller):
|
||||
iot_device = request.env(user=SUPERUSER_ID)['attendance.iot'].search([('name', '=', sn)], limit=1)
|
||||
if not iot_device:
|
||||
request.env(user=SUPERUSER_ID)["attendance.iot"].create({'name': sn})
|
||||
iot_users = request.env(user=SUPERUSER_ID)['attendance.iot.user'].search([('employee_id', '=', employee.id)])
|
||||
iot_users = request.env(user=SUPERUSER_ID)['attendance.iot.user'].search([('employee_id', '=', employee.id), ('attendance_iot_id', '=', iot_device.id)])
|
||||
# employee.write({'image_1920': base64.b64encode(urllib.parse.unquote(vl_photo))})
|
||||
if not iot_users:
|
||||
request.env(user=SUPERUSER_ID)['attendance.iot.user'].create({
|
||||
|
||||
@@ -8,7 +8,6 @@ class AttendanceIotUser(models.Model):
|
||||
attendance_iot_id = fields.Many2one('attendance.iot', string="设备号")
|
||||
attendance_address = fields.Char(related='attendance_iot_id.attendance_address', string="设备地址")
|
||||
employee_id = fields.Many2one('hr.employee', string="员工")
|
||||
department_id = fields.Many2one(related='employee_id.department_id', string="部门")
|
||||
company_id = fields.Many2one(related='employee_id.company_id', string="公司", store=True)
|
||||
company_id = fields.Many2one(related='employee_id.company_id', string="公司")
|
||||
id_valid = fields.Date(string="有效日期")
|
||||
image_1920 = fields.Image("一寸照")
|
||||
image_1920 = fields.Many2one('ir.attachment', string="一寸照")
|
||||
|
||||
@@ -6,13 +6,12 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom">
|
||||
<field name="employee_id"/>
|
||||
<field name="image_1920"/>
|
||||
<field name="attendance_iot_id"/>
|
||||
<field name="attendance_iot_id" string="设备号"/>
|
||||
<field name="attendance_address"/>
|
||||
<field name="department_id" column_invisible="1"/>
|
||||
<field name="image_1920"/>
|
||||
<field name="company_id" column_invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class AppletAttendance(Controller):
|
||||
card_rice = address_id.card_rice * 0.001 # 打卡范围
|
||||
if not self.is_within_radius_geopy(att_latitude, att_longitude, latitude, longitude, card_rice):
|
||||
return_data = {
|
||||
'data': {"message": "超出范围,不允许打卡", 'state': 'yes', 'state_result': '超出范围'},
|
||||
'data': {"message": "超出范围,不允许打卡", 'state': 'no', 'state_result': '超出范围'},
|
||||
'check_in': '未签到',
|
||||
'check_out': '未签到',
|
||||
'location': self_address['formatted_address'],
|
||||
@@ -235,7 +235,6 @@ class AppletAttendance(Controller):
|
||||
'is_early_card': sum(1 for rec in current_attendance if rec.is_early_card),
|
||||
'is_late_card': sum(1 for rec in current_attendance if rec.is_late_card),
|
||||
'is_abnormal': sum(1 for rec in current_attendance if rec.is_abnormal),
|
||||
# !!!!!!!!!!
|
||||
'is_holiday': sum(1 for rec in current_attendance if rec.is_abnormal),
|
||||
'is_go_away': sum(1 for rec in current_attendance if rec.is_abnormal),
|
||||
'is_no_work': sum(1 for rec in current_attendance if rec.is_abnormal),
|
||||
@@ -260,16 +259,12 @@ class AppletAttendance(Controller):
|
||||
for att in attendances:
|
||||
# 获取班次信息
|
||||
shift_name = att.shift_id.name if att.shift_id else ""
|
||||
|
||||
# 计算标准打卡时间
|
||||
check_in_start = att.shift_id.template_id.check_in_start if att.shift_id and att.shift_id.template_id else 0
|
||||
check_out_end = att.shift_id.template_id.check_out_end if att.shift_id and att.shift_id.template_id else 0
|
||||
|
||||
start_hour = int(check_in_start)
|
||||
start_minute = int((check_in_start - start_hour) * 60)
|
||||
end_hour = int(check_out_end)
|
||||
end_minute = int((check_out_end - end_hour) * 60)
|
||||
|
||||
# 格式化标准时间
|
||||
standard_check_in_str = f"{start_hour:02d}:{start_minute:02d}"
|
||||
standard_check_out_str = f"{end_hour:02d}:{end_minute:02d}"
|
||||
|
||||
Reference in New Issue
Block a user