diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index 568452d3d..51c06ec98 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -340,15 +340,7 @@ class HrAttendance(models.Model): employee_record.write({'absenteeism_card': True, 'is_abnormal': True }) - else: - # 没有记录且需要标记为缺卡时,创建新记录 - self.env['hr.attendance'].create({ - 'employee_id': employee.id, - 'current_data': today, - 'is_no_card': is_no_card, - 'check_in': False, - 'check_out': False - }) + def _process_shift_days(self, current_data): """ diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py index d72bdbd7a..790356885 100644 --- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -235,7 +235,10 @@ class YuthonVacationReports(models.Model): month_start = date(year, month, 1) month_end = date(year, month, calendar.monthrange(year, month)[1]) # 计算start_date:外派且无合同时用month_start,否则取合同开始日与month_start的最大值 - start_date = month_start if (is_outside and not contract) else max(contract.date_start, month_start) + if contract.date_start: + start_date = month_start if (is_outside and not contract) else max(contract.date_start, month_start) + else: + continue # 计算end_date:外派且无合同时用month_end;有合同且有结束日则取最小值;其他情况用month_end end_date = month_end if (is_outside and not contract) else (min(contract.date_end, month_end) if contract.date_end else month_end) diff --git a/yuthon_property/models/property_meter_water.py b/yuthon_property/models/property_meter_water.py index 5a9d0e1eb..af87d3948 100644 --- a/yuthon_property/models/property_meter_water.py +++ b/yuthon_property/models/property_meter_water.py @@ -194,7 +194,7 @@ class MeterWaterLine(models.Model): current_read = fields.Float(string='本次读数', group_operator=None) unit_number = fields.Char(string='单元编号/用途') unit = fields.Float(string='当月单价', group_operator=None, digits=(16, 4)) - receivables = fields.Float(string="应收", store=True, help="应收金额=本次用量*单价*(1+线损)", compute="_compute_receivables") + receivables = fields.Float(string="应收", store=True, help="应收金额=本次用量*单价*(1+线损)") gauge_magnification = fields.Integer(string='仪表倍率', default=1) last_reading_time = fields.Date(string="最后读数时间") type = fields.Selection([("public", "公共"), ("fees", "收费")], string="类型") @@ -238,8 +238,8 @@ class MeterWaterLine(models.Model): else: rec.meter_date_month = False - @api.depends("line_loss", "current_meter", "unit") - def _compute_receivables(self): + @api.onchange('line_loss', 'current_meter', 'unit') + def onchange_receivables(self): for record in self: if record.line_loss and record.current_meter and record.unit: raw_value = record.current_meter * record.unit * (1 + record.line_loss) * record.gauge_magnification