diff --git a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py index fbf610e58..6d7f92359 100644 --- a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py +++ b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py @@ -88,6 +88,7 @@ class HrAttendanceDetail(models.Model): if record.employee_id and record.checkin_time and record.checkin_type != '未打卡': self._update_actual_attendance(record) self._sync_to_hr_attendance(record) + _logger.info(f"{record.employee_id.name}--------") return record def _update_actual_attendance(self, record): @@ -121,9 +122,37 @@ class HrAttendanceDetail(models.Model): attendance.check_in = record.checkin_time attendance.check_out = record.checkin_time else: - now_time = fields.Datetime.to_datetime(checkin_date) + timedelta(hours=8, days=1) - start_time = now_time - timedelta(days=2) - self.env["hr.attendance.detail"].get_hr_attendance_time(record.employee_id, now_time, start_time) + local_start = datetime.combine(checkin_date, datetime.min.time()) + local_end = local_start + timedelta(days=1) + utc_start = local_start - timedelta(hours=8) + utc_end = local_end - timedelta(hours=8) + domain = [ + ("exception_type", "!=", "未打卡"), + ('employee_id', '=', record.employee_id.id), + ('checkin_time', '>=', fields.Datetime.to_string(utc_start)), + ('checkin_time', '<', fields.Datetime.to_string(utc_end)) + ] + check_in = None + check_out = None + attendance_records = self.env['hr.attendance.detail'].search(domain) + if attendance_records: + checkin_times = sorted(attendance_records.mapped('checkin_time')) + check_in = checkin_times[0] + if len(checkin_times) == 1: + check_out = 0 + else: + check_out = checkin_times[-1] + if check_in is not None: + attendance.create({ + 'employee_id': record.employee_id.id, + 'check_in': check_in, + 'check_out': check_out, + 'current_data': checkin_date, + }) + + # now_time = fields.Datetime.to_datetime(checkin_date) + timedelta(hours=8, days=1) + # start_time = now_time - timedelta(days=2) + # self.env["hr.attendance.detail"].get_hr_attendance_time(record.employee_id, now_time, start_time) diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard.py b/yuthon_property_approval/wizard/property_reconciliation_wizard.py index 3da1f531a..da85ccdf4 100644 --- a/yuthon_property_approval/wizard/property_reconciliation_wizard.py +++ b/yuthon_property_approval/wizard/property_reconciliation_wizard.py @@ -258,6 +258,6 @@ class PropertyReconciliationLine(models.Model): rent = fields.Float(string='未收') amount = fields.Float(string='金额', store=True) collection_type = fields.Selection([('deposit', '押金'), ('rent', '租金'), ('water_fee', '水费'), - ('electricity_fee', '电费'), ('penalty', '违约'), ('management_fee', '管理费'), ('repair_fee', '维修费'), + ('electricity_fee', '电费'), ('penalty', '违约金'), ('management_fee', '管理费'), ('repair_fee', '维修费'), ('other', '其他')], string='收款类型') remake = fields.Char(string='备注') \ No newline at end of file