添加功能

This commit is contained in:
zhou
2025-05-11 20:06:32 +08:00
parent 3b0d8db601
commit 1f0d5a1a7d
3 changed files with 12 additions and 3 deletions
+10 -3
View File
@@ -64,7 +64,7 @@ class HrLeave(models.Model):
leave_documents_ids = fields.Many2many(related='holiday_status_id.leave_documents_id', string="假期详情说明", readonly=True)
details = fields.Text(string="假期流程说明")
request_hour_from_real = fields.Selection([
('0', '00:00'), ('0.5', '00:30'),
('0', '0:00'), ('0.5', '0:30'),
('1', '01:00'), ('1.5', '01:30'),
('2', '02:00'), ('2.5', '02:30'),
('3', '03:00'), ('3.5', '03:30'),
@@ -97,7 +97,7 @@ class HrLeave(models.Model):
# column2='attachment_id'
# )
request_hour_from = fields.Selection([
('0', '00:00'), ('0.5', '00:30'),
('0', '0:00'), ('0.5', '0:30'),
('1', '01:00'), ('1.5', '01:30'),
('2', '02:00'), ('2.5', '02:30'),
('3', '03:00'), ('3.5', '03:30'),
@@ -231,7 +231,8 @@ class HrLeave(models.Model):
elif current_date_str in shift_days_list:
if not is_weekend:
days += 1
elif is_weekend:
else :
if is_weekend:
days -= 1
current_date += timedelta(days=1)
@@ -248,6 +249,12 @@ class HrLeave(models.Model):
if not self.env.context.get('no_change_request_unit_hours'):
super()._compute_request_unit_hours()
@api.constrains('number_of_hours_text')
def _check_number_of_hours_text(self):
if self.number_of_hours_text:
if self.number_of_hours_text == 0:
raise UserError('请假天数不能为0')
@api.constrains('date_from', 'date_to', 'employee_id')
def _check_date(self):
if self.env.context.get('leave_skip_date_check', False):
@@ -28,6 +28,7 @@ class HrAttendance(models.Model):
down_card_location = fields.Char(string="下班打卡地点")
out_card_time = fields.Datetime(string="外出打卡时间")
out_card_location = fields.Char(string="外出打卡地点")
department_id = fields.Many2one(related='employee_id.department_id', string="部门", store=True)
work_hours = fields.Float(string="工作时长")
current_data = fields.Date(string='打卡日期', tracking=True)
week = fields.Selection([('one', '一'), ('two', '二'), ('three', '三'),
@@ -20,6 +20,7 @@
<field name="week" optional="show" class="list_ids_width"/>
<field name="user_id" column_invisible="1"/>
<field name="is_clock_card" column_invisible="1"/>
<field name="department_id" column_invisible="1"/>
<field name="is_no_card" optional="show" class="list_ids_width"/>
<field name="is_early_card" optional="show" class="list_ids_width"/>
<field name="is_late_card" optional="show" class="list_ids_width"/>