模板 需要什么加什么
This commit is contained in:
@@ -91,18 +91,23 @@ class HrAttendanceMonthDetail(models.Model):
|
||||
('11', '11月份'),
|
||||
('12', '12月份')
|
||||
], string="考勤月份")
|
||||
# todo 需要什么字段往上加什么
|
||||
required_attendance_days = fields.Float(string="应出勤天数")
|
||||
actual_attendance_days = fields.Float(string="实际出勤天数")
|
||||
compensatory_leave = fields.Float(string="调休(小时)")
|
||||
leave_of_absence = fields.Float(string="事假(小时)")
|
||||
leave_of_sick = fields.Float(string="病假(天)")
|
||||
come_late = fields.Float(string="迟到(次)")
|
||||
work_overtime = fields.Float(string="加班(小时)")
|
||||
statutory_leave = fields.Float(string="法定假(天)")
|
||||
work_overtime = fields.Float(string="加班(小时)")
|
||||
# todo 需要什么字段往上加什么
|
||||
# 打卡
|
||||
come_late = fields.Float(string="迟到(次)")
|
||||
is_early_card = fields.Float(string="早退(次)")
|
||||
is_no_card = fields.Float(string="缺卡(次)")
|
||||
# 假期
|
||||
unpaid_leave = fields.Float(string="无薪假(小时)")
|
||||
|
||||
|
||||
note = fields.Char(string='备注')
|
||||
|
||||
hr_attendance_month_id = fields.Many2one('hr.attendance.month', string="出勤月度汇总", ondelete="cascade", readonly=True)
|
||||
company_id = fields.Many2one(related="hr_attendance_month_id.company_id")
|
||||
signature = fields.Image(string="签名", copy=False, attachment=True, max_width=1024, max_height=1024)
|
||||
@@ -220,19 +225,24 @@ class HrAttendanceMonthDetail(models.Model):
|
||||
"""
|
||||
self.ensure_one()
|
||||
days = calendar.monthrange(int(self.current_year), int(self.current_month))[1]
|
||||
come_late = 0
|
||||
is_late_card = 0
|
||||
is_early_card = 0
|
||||
is_no_card = 0
|
||||
for n in range(days):
|
||||
# 根据出勤时间判断是否打卡
|
||||
current_date = datetime.date(int(self.current_year), int(self.current_month), n + 1)
|
||||
attendance_obj = self.env["hr.attendance"].sudo().search([('employee_id', '=', employee.id), ("current_data", '=', current_date)])
|
||||
is_come_late = False
|
||||
for obj in attendance_obj:
|
||||
if obj.is_come_late():
|
||||
# 当天有打卡记录说明已经出勤
|
||||
is_come_late = True
|
||||
if is_come_late is True:
|
||||
come_late += 1
|
||||
return come_late
|
||||
# 迟到
|
||||
if obj.is_late_card:
|
||||
is_late_card += 1
|
||||
# 早退
|
||||
if obj.is_early_card:
|
||||
is_early_card += 1
|
||||
# 缺卡
|
||||
if obj.is_no_card:
|
||||
is_no_card += 1
|
||||
return is_late_card, is_early_card, is_no_card
|
||||
|
||||
def _hr_attendance_month_detail_action(self):
|
||||
"""
|
||||
@@ -294,7 +304,7 @@ class HrAttendanceMonthDetail(models.Model):
|
||||
('date_to', '>=', date_start)
|
||||
]
|
||||
if type_list:
|
||||
domain.append(('holiday_status_id.holiday_type', 'in', type_list))
|
||||
domain.append(('holiday_status_id.name', 'in', type_list))
|
||||
hr_leaves = self.env['hr.leave'].sudo().search(domain)
|
||||
hours = 0.0
|
||||
days = 0.0
|
||||
@@ -316,41 +326,21 @@ class HrAttendanceMonthDetail(models.Model):
|
||||
# 排班的进行统计
|
||||
if self.employee_id.default_planning_role_id:
|
||||
# todo 需要什么字段往上加什么
|
||||
# # 应出勤天数
|
||||
# required_attendance_days = self._get_planning_required_attendance_days(self.employee_id)
|
||||
# self.required_attendance_days = required_attendance_days
|
||||
# # 实际出勤天数
|
||||
# actual_attendance_days = self._get_actual_attendance_days(self.employee_id)
|
||||
# self.actual_attendance_days = actual_attendance_days
|
||||
# 迟到(次):上班时间 < 上班打卡时间
|
||||
come_late = self._get_come_late(self.employee_id)
|
||||
self.come_late = come_late
|
||||
# 迟到, 早退, 缺卡
|
||||
self.come_late, self.is_early_card, self.is_no_card = self._get_come_late(self.employee_id)
|
||||
# 无薪假:hr.leave表
|
||||
days, hours = self._get_hr_leave_type(self.employee_id, ['无薪假'])
|
||||
self.unpaid_leave = hours
|
||||
|
||||
# 行政的进行统计
|
||||
if not self.employee_id.default_planning_role_id:
|
||||
# todo 需要什么字段往上加什么
|
||||
# # 应出勤天数
|
||||
# required_attendance_days = self._get_required_attendance_days(self.employee_id)
|
||||
# self.required_attendance_days = required_attendance_days
|
||||
# # 实际出勤天数
|
||||
# actual_attendance_days = self._get_actual_attendance_days(self.employee_id)
|
||||
# self.actual_attendance_days = actual_attendance_days
|
||||
# # 调休(小时):取员工表上字段
|
||||
# work_overtime, compensatory_leave = self._get_overtime_annual_summary(self.employee_id)
|
||||
# self.compensatory_leave = compensatory_leave
|
||||
# # 事假(小时):hr.leave表
|
||||
# days, hours = self._get_hr_leave_type(self.employee_id, ['personal'])
|
||||
# self.leave_of_absence = hours + days * 8
|
||||
# # 病假(天):hr.leave表
|
||||
# days, hours = self._get_hr_leave_type(self.employee_id, ['sick'])
|
||||
# self.leave_of_sick = hours // 8 + days
|
||||
# 迟到(次):上班时间 < 上班打卡时间
|
||||
come_late = self._get_come_late(self.employee_id)
|
||||
self.come_late = come_late
|
||||
# # 加班(小时):取员工表上字段
|
||||
# self.work_overtime = work_overtime
|
||||
# 法定假(天):hr.leave表
|
||||
# days, hours = self._get_hr_leave_type(self.employee_id, ['marriage', 'maternity', 'paternity', 'funeral', 'parental'])
|
||||
# self.statutory_leave = hours // 8 + days
|
||||
# 迟到, 早退, 缺卡
|
||||
self.come_late, self.is_early_card, self.is_no_card = self._get_come_late(self.employee_id)
|
||||
# 无薪假:hr.leave表
|
||||
days, hours = self._get_hr_leave_type(self.employee_id, ['无薪假'])
|
||||
self.unpaid_leave = hours
|
||||
|
||||
return True
|
||||
|
||||
def update_attendance_month(self):
|
||||
|
||||
@@ -67,20 +67,17 @@
|
||||
<field name="current_year" />
|
||||
<field name="current_month" />
|
||||
<field name="signature" widget="image" options='{"size": [80, 40]}' />
|
||||
<!-- todo 需要什么字段往上加什么-->
|
||||
<!-- <field name="required_attendance_days"/>-->
|
||||
<!-- <field name="actual_attendance_days"/>-->
|
||||
<!-- <field name="compensatory_leave"/>-->
|
||||
<field name="leave_of_absence"/>
|
||||
<field name="leave_of_sick"/>
|
||||
<!-- todo 需要什么字段往上加什么-->
|
||||
<!-- 打卡-->
|
||||
<field name="come_late"/>
|
||||
<field name="work_overtime"/>
|
||||
<field name="statutory_leave"/>
|
||||
<field name="is_early_card" />
|
||||
<field name="is_no_card" />
|
||||
<!-- 请假-->
|
||||
<field name="unpaid_leave" />
|
||||
<!-- 其他-->
|
||||
<field name="note" optional="hide"/>
|
||||
<!-- <field name="company_area" optional="hide"/>-->
|
||||
<field name="company_id" optional="hide"/>
|
||||
<field name="state" widget="badge" decoration-info="state == 'unconfirmed'" decoration-success="state == 'confirmed'"/>
|
||||
<!-- <button name="action_show_details" string="打卡图片" type="object" title="Show Details" icon="fa-list"/>-->
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -15,29 +15,17 @@
|
||||
<t t-set="entries">
|
||||
<ul class="list-group list-group-flush flex-wrap flex-row flex-lg-column">
|
||||
<!-- todo 需要什么字段往上加什么-->
|
||||
<li class="list-group-item d-grid align-content-start">
|
||||
<strong>应出勤天数:<span t-field="attendance_month.required_attendance_days"/>天</strong>
|
||||
</li>
|
||||
<li class="list-group-item d-grid align-content-start">
|
||||
<strong>实际出勤天数:<span t-field="attendance_month.actual_attendance_days"/>天</strong>
|
||||
</li>
|
||||
<li class="list-group-item d-grid align-content-start">
|
||||
<strong>调休(小时):<span t-field="attendance_month.compensatory_leave"/>小时</strong>
|
||||
</li>
|
||||
<li class="list-group-item d-grid align-content-start">
|
||||
<strong>事假(小时):<span t-field="attendance_month.leave_of_absence"/>小时</strong>
|
||||
</li>
|
||||
<li class="list-group-item d-grid align-content-start">
|
||||
<strong>病假(天):<span t-field="attendance_month.leave_of_sick"/>天</strong>
|
||||
</li>
|
||||
<li class="list-group-item d-grid align-content-start">
|
||||
<strong>迟到(次):<span t-field="attendance_month.come_late"/>次</strong>
|
||||
</li>
|
||||
<li class="list-group-item d-grid align-content-start">
|
||||
<strong>加班(小时):<span t-field="attendance_month.work_overtime"/>小时</strong>
|
||||
<strong>早退(次):<span t-field="attendance_month.is_early_card"/>次</strong>
|
||||
</li>
|
||||
<li class="list-group-item d-grid align-content-start">
|
||||
<strong>法定假(天):<span t-field="attendance_month.statutory_leave"/>天</strong>
|
||||
<strong>缺卡(次):<span t-field="attendance_month.is_no_card"/>次</strong>
|
||||
</li>
|
||||
<li class="list-group-item d-grid align-content-start">
|
||||
<strong>无薪假(小时):<span t-field="attendance_month.unpaid_leave"/>小时</strong>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-group list-group-flush flex-wrap flex-row flex-lg-column" />
|
||||
|
||||
Reference in New Issue
Block a user