diff --git a/yuthon_hr_attendance/models/overtime_approval.py b/yuthon_hr_attendance/models/overtime_approval.py index 01a170767..9bb2ac782 100644 --- a/yuthon_hr_attendance/models/overtime_approval.py +++ b/yuthon_hr_attendance/models/overtime_approval.py @@ -271,13 +271,15 @@ class OvertimeApprovals(models.Model): 'workflow_id': workflow_id.id, }) - @api.depends('users_id', 'duration') + @api.depends('users_id', 'duration', 'start_time', 'end_time') def _compute_name(self): for rec in self: + start_time_str = rec.start_time.strftime('%Y-%m-%d %H:%M') if rec.start_time else '无' + end_time_str = rec.end_time.strftime('%H:%M') if rec.end_time else '无' if rec.duration == 0: - rec.name = f"{rec.users_id.name}加班" + rec.name = f"{rec.users_id.name}加班 {start_time_str}-{end_time_str}" else: - rec.name = f"{rec.users_id.name}加班{rec.duration}小时" + rec.name = f"{rec.users_id.name}加班{rec.duration}小时 {start_time_str}-{end_time_str}" @api.depends('start_time', 'end_time') def _compute_overtime_type(self): diff --git a/yuthon_property_approval/models/inherit_yuthon_property.py b/yuthon_property_approval/models/inherit_yuthon_property.py index c605ed8f9..450bbd85b 100644 --- a/yuthon_property_approval/models/inherit_yuthon_property.py +++ b/yuthon_property_approval/models/inherit_yuthon_property.py @@ -269,30 +269,6 @@ class PropertyBankStatements(models.Model): def revocation(self): self.ensure_one() - current_rec = self[0] - # if current_rec.bank_state == 'reconciled': - # domain = [ - # ('your_own_unit', '=', current_rec.your_own_unit), - # ('bank_state', '=', 'reconciled'), - # ('name_account', '=', current_rec.name_account) - # ] - # same_group_records = self.env[self._name].search(domain) - # if same_group_records: - # # 按start_time倒序排序,找到最近的记录 - # sorted_records = sorted( - # same_group_records, - # key=lambda r: r.start_time or '', - # reverse=True - # ) - # latest_record = sorted_records[0] - # # 检查当前记录是否是最近的一条 - # if current_rec.id != latest_record.id: - # raise UserError( - # f"只能从最近的记录开始撤销!\n" - # f"当前记录时间: {current_rec.start_time + timedelta(hours=8)}\n" - # f"最近记录时间: {latest_record.start_time + timedelta(hours=8)}" - # ) - for modify in self.receivable_modify_ids: if modify.is_write: new_delivered = modify.receivable_id.delivered1 - modify.amount @@ -303,7 +279,8 @@ class PropertyBankStatements(models.Model): if not modify.is_penalty: modify.receivable_id.remark = None else: - modify.receivable_id.unlink() + if modify.is_penalty: + modify.receivable_id.unlink() if self.receivable_modify_ids: self.receivable_modify_ids.unlink()