添加功能
This commit is contained in:
@@ -50,7 +50,7 @@ class HrAttendance(models.Model):
|
||||
is_holiday = fields.Boolean(string="是否为节假日")
|
||||
noon_duty = fields.Datetime(string="中值")
|
||||
night_duty = fields.Datetime(string="晚值")
|
||||
is_approval = fields.Boolean(string="是否审批修正", default=False)
|
||||
is_approval = fields.Boolean(string="是否手动修正", default=False)
|
||||
is_check_in_red = fields.Boolean(string="是否上班打卡异常")
|
||||
is_check_out_red = fields.Boolean(string="是否下班打卡异常")
|
||||
is_warning = fields.Boolean(compute='_compute_is_warning', string="警告", store=True)
|
||||
@@ -287,7 +287,8 @@ class HrAttendance(models.Model):
|
||||
('employee_id', 'not in', employee_list),
|
||||
('is_expatriation', '=', False),
|
||||
('is_clock_card', '=', False),
|
||||
('is_workflow', '=', False)
|
||||
('is_workflow', '=', False),
|
||||
('is_approval', '=', False)
|
||||
])
|
||||
all_employees = self.env['hr.employee'].search([
|
||||
('id', 'not in', employee_list)
|
||||
@@ -681,43 +682,6 @@ class HrAttendance(models.Model):
|
||||
}
|
||||
}
|
||||
|
||||
def button_correct_approval(self):
|
||||
for record in self:
|
||||
if not record.shift_id:
|
||||
year = record.current_data.year
|
||||
month = record.current_data.month
|
||||
day = record.current_data.day
|
||||
current_date = datetime.today()
|
||||
min_hour_from = record.employee_id.resource_id.calendar_id.attendance_ids[0].hour_from
|
||||
min_hour = int(min_hour_from)
|
||||
min_minute = int(min_hour_from * 10 % min_hour_from)
|
||||
will_datetime_start = current_date.replace(year=year, month=month, day=day, hour=min_hour, minute=min_minute) - timedelta(hours=8)
|
||||
record.write({'check_in': will_datetime_start, 'is_approval': True, 'is_abnormal':False, 'is_no_card':False, 'is_early_card':False, 'is_late_card':False})
|
||||
max_hour_to = record.employee_id.resource_id.calendar_id.attendance_ids[-1].hour_to
|
||||
max_hour = int(max_hour_to)
|
||||
max_minute = int(max_hour_to * 10 % max_hour_to)
|
||||
will_datetime_end = current_date.replace(year=year, month=month, day=day, hour=max_hour, minute=max_minute) - timedelta(hours=8)
|
||||
record.write({'check_out': will_datetime_end, 'is_approval': True, 'is_abnormal':False, 'is_no_card':False, 'is_early_card':False, 'is_late_card':False, 'absenteeism_card':False})
|
||||
else:
|
||||
check_in_start = record.shift_id.template_id.check_in_start
|
||||
check_out_end = record.shift_id.template_id.check_out_end
|
||||
date = record.current_data
|
||||
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)
|
||||
# 拼接成 datetime 对象
|
||||
start_datetime = datetime.combine(date, datetime.min.time()).replace(
|
||||
hour=start_hour, minute=start_minute, second=0, microsecond=0
|
||||
)
|
||||
end_datetime = datetime.combine(date, datetime.min.time()).replace(
|
||||
hour=end_hour, minute=end_minute, second=0, microsecond=0
|
||||
)
|
||||
if record.shift_id.template_id.day2 == '次日':
|
||||
end_datetime = end_datetime + timedelta(days=1)
|
||||
record.write(
|
||||
{'check_out': end_datetime, 'check_in':start_datetime, 'is_approval': True, 'is_abnormal': False, 'is_no_card': False,
|
||||
'is_early_card': False, 'is_late_card': False, 'absenteeism_card':False})
|
||||
|
||||
def button_batch_correct(self):
|
||||
attendance_ids = self.env["hr.attendance"].browse(
|
||||
|
||||
@@ -12,6 +12,7 @@ class YuthonReassignmentApproval(models.Model):
|
||||
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
|
||||
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="公司")
|
||||
code = fields.Char(string="编号",
|
||||
default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_reassignment_approval_code'))
|
||||
phone = fields.Char(string='联系电话')
|
||||
|
||||
@@ -76,11 +76,12 @@
|
||||
<group string="异动信息" col="3">
|
||||
<group>
|
||||
<field name="change_kind"/>
|
||||
<field name="change_parent_id"/>
|
||||
<field name="change_job_id"/>
|
||||
<field name="change_parent_id" domain="[('company_id', '=' ,company_id)]"/>
|
||||
company_id
|
||||
<field name="change_job_id" domain="[('company_id', '=' , company_id)]"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="change_structure_id"/>
|
||||
<field name="change_structure_id" domain="[('company_id', '=' , company_id)]"/>
|
||||
<field name="change_date"/>
|
||||
</group>
|
||||
<group>
|
||||
|
||||
@@ -996,8 +996,7 @@ class PropertyRentList(models.Model):
|
||||
contract_id = fields.Many2one('property.lease.contract', string="关联租赁合同审批")
|
||||
tenure_type = fields.Selection(related='contract_id.tenure_type', string="权属类型", store=True)
|
||||
property_address = fields.Text(string="物业信息", compute='get_property_address')
|
||||
contract_sort = fields.Selection(related='contract_id.contract_sort', string="资产类型", store=True)
|
||||
contract_sort1 = fields.Selection(related='contract_id.contract_sort', string="资产类型", store=True)
|
||||
contract_sort = fields.Selection([('property', '物业'), ('guanggao', '广告位'),('parking', '停车场'), ('guanzi', '管子间'), ('room', '机房'), ('base_station','基站'), ('other', '其他')], related='contract_id.contract_sort', string="资产类型", index=True)
|
||||
company_id = fields.Many2one(related='contract_id.lessor_id', string="出租方公司", store=True)
|
||||
|
||||
@api.depends('contract_id')
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
<field name="tenure_type"/>
|
||||
<field name="contract_id"/>
|
||||
<group expand="0" string="group_by">
|
||||
<filter name="contract_sort1" string="资产类型" context="{'group_by':'contract_sort1'}"/>
|
||||
<filter name="contract_sort" string="资产类型" context="{'group_by':'contract_sort'}"/>
|
||||
<filter name="group_company_id" string="公司" context="{'group_by':'company_id'}"/>
|
||||
<filter name="group_tenure_type" string="权属类型" context="{'group_by':'tenure_type'}"/>
|
||||
<filter name="group_admin_id" string="管理员" context="{'group_by':'admin_id'}"/>
|
||||
|
||||
Reference in New Issue
Block a user