diff --git a/soong_workflow/views/soong_workflow_record.xml b/soong_workflow/views/soong_workflow_record.xml index e43208de1..3eede1329 100644 --- a/soong_workflow/views/soong_workflow_record.xml +++ b/soong_workflow/views/soong_workflow_record.xml @@ -17,7 +17,7 @@ soong.workflow.record.tree soong.workflow.record - + diff --git a/yuthon_hr_attendance/__manifest__.py b/yuthon_hr_attendance/__manifest__.py index 7890035ad..261754fbd 100644 --- a/yuthon_hr_attendance/__manifest__.py +++ b/yuthon_hr_attendance/__manifest__.py @@ -56,6 +56,11 @@ 'wizard/yuthon_duty_summary_wizard_views.xml', # 'wizard/attendance_iot_manager_wizard_views.xml', ], + 'assets': { + 'web.assets_backend': [ + 'yuthon_hr_attendance/static/scss/hr_attendance_scss.scss', + ], + }, 'installable': True, 'application': True, 'license': 'LGPL-3', diff --git a/yuthon_hr_attendance/models/card_approval.py b/yuthon_hr_attendance/models/card_approval.py index d8d07e7cb..a80a95f75 100644 --- a/yuthon_hr_attendance/models/card_approval.py +++ b/yuthon_hr_attendance/models/card_approval.py @@ -18,7 +18,7 @@ class CardApprovals(models.Model): is_issues = fields.Boolean(string='是否上会') related_issues_id = fields.Many2one('issue.library', string="关联议题") reason_application = fields.Html(string="申请事由") - replacement_time = fields.Datetime(string="补卡时间") + replacement_time = fields.Selection([('work', '上班卡'), ('quitting', '下班卡'), ('all', '全天卡')], string="补卡") actual_punch = fields.Datetime(string="实际打卡") documents_ids = fields.Many2many('ir.attachment', string="附件") diff --git a/yuthon_hr_attendance/models/go_approval.py b/yuthon_hr_attendance/models/go_approval.py index 685898852..ea956851e 100644 --- a/yuthon_hr_attendance/models/go_approval.py +++ b/yuthon_hr_attendance/models/go_approval.py @@ -16,7 +16,7 @@ class GoApprovals(models.Model): users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id) department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门") reason_application = fields.Char(string="事由") - go_approval_ids = fields.One2many('go.approvals.line', 'go_approval_id', string="外出详情") + go_approval_ids = fields.One2many('go.approvals.line', 'go_approval_id', string="外出详情", default=lambda self: self._default_user_lines()) is_issues = fields.Boolean(string='是否上会') related_issues_id = fields.Many2one('issue.library', string="关联议题") @@ -37,12 +37,37 @@ class GoApprovals(models.Model): elif self.related_issues_id: raise UserError("已经创建了相关的上会记录,不能取消勾选") + @api.model + def _default_user_lines(self): + return [(0, 0, {'users_id': self.env.user.id})] + + class GoApprovalsLine(models.Model): _name = 'go.approvals.line' _description = "外出人明细" go_approval_id = fields.Many2one('go.approval', string="关联外出申请") - overtime_people = fields.Many2one('hr.employee', string="外出人") + users_id = fields.Many2one('res.users', string="外出人") + applicants_unit = fields.Selection([('hour', '小时'), ('day', '天')], string="申请单位") documents_ids = fields.Many2many('ir.attachment', string="附件") date_start = fields.Datetime(string="开始时间") - date_end = fields.Datetime(string="结束时间") \ No newline at end of file + date_end = fields.Datetime(string="结束时间") + + @api.onchange('date_start', 'date_end') + def _onchange_weekend(self): + for record in self: + if record.applicants_unit == 'day' and record.date_start and record.date_end: + start_date = record.date_start.date() + end_date = record.date_end.date() + current_date = start_date + while current_date <= end_date: + if current_date.weekday() in (5, 6): + raise UserError("申请时间范围内包含周六或周日,请重新选择日期") + current_date += timedelta(days=1) + + @api.onchange('date_start', 'date_end') + def _onchange_dates(self): + for record in self: + if record.date_start and record.date_end: + if record.date_start >= record.date_end: + raise UserError("开始时间必须小于结束时间!") \ No newline at end of file diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index 0d6bb1fb4..0a5109096 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -22,6 +22,8 @@ class HrAttendance(models.Model): out_card_location = fields.Char(string="外出打卡地点") work_hours = fields.Float(string="工作时长") current_data = fields.Date(string='打卡日期', tracking=True) + weed = fields.Char(string='星期', compute='_compute_weed') + def hr_attendance_time(self): today = fields.Date.today() @@ -103,4 +105,14 @@ class HrAttendance(models.Model): "context": { 'default_users_id': self.employee_id.user_id.id, } - } \ No newline at end of file + } + + @api.depends('check_in') + def _compute_weed(self): + for record in self: + if record.check_in: + weekday = record.check_in.weekday() + weekdays_cn = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"] + record.weed = weekdays_cn[weekday] + else: + record.weed = False \ No newline at end of file diff --git a/yuthon_hr_attendance/models/overtime_approval.py b/yuthon_hr_attendance/models/overtime_approval.py index efc9d7538..95290d709 100644 --- a/yuthon_hr_attendance/models/overtime_approval.py +++ b/yuthon_hr_attendance/models/overtime_approval.py @@ -21,6 +21,7 @@ class OvertimeApprovals(models.Model): is_issues = fields.Boolean(string='是否上会') details = fields.Text(string="加班说明") related_issues_id = fields.Many2one('issue.library', string="关联议题") + documents_ids = fields.Many2many('ir.attachment', string="附件") @api.onchange('is_issues') def _onchange_is_issues(self): @@ -102,7 +103,6 @@ class OvertimeUserLine(models.Model): users_id = fields.Many2one('res.users', string="加班人员") department_id = fields.Many2one('hr.department', string="部门") overtime_hours = fields.Float(string="本月加班时长") - documents_ids = fields.Many2many('ir.attachment', string="附件") start_time = fields.Datetime(string="开始时间") end_time = fields.Datetime(string="结束时间") hours = fields.Float(string="加班时长", compute="_compute_hours") diff --git a/yuthon_hr_attendance/models/remove_holiday_approval.py b/yuthon_hr_attendance/models/remove_holiday_approval.py index db9c24a51..b3ecbd3a3 100644 --- a/yuthon_hr_attendance/models/remove_holiday_approval.py +++ b/yuthon_hr_attendance/models/remove_holiday_approval.py @@ -15,12 +15,9 @@ class RemoveHolidayApprovals(models.Model): date = fields.Datetime(string="日期", default=fields.Datetime.now) users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id) department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门") - partner_id = fields.Many2one('res.partner', string="来文单位") statu = fields.Selection([('drft', '草稿'), ('going', '执行中'), ('cancel', '已取消'), ('done', '已完成')], string="状态", default='drft') - entry_time = fields.Datetime(string="入职时间") type_remove_holiday = fields.Char(string="销假类型") - user_sex = fields.Selection([('girl', '女'), ('boy', '男')], string="性别") role_id = fields.Many2one('yuthon.user.role', string="岗位") date_start = fields.Datetime(string="开始时间", default=fields.Datetime.now) date_end = fields.Datetime(string="结束时间") diff --git a/yuthon_hr_attendance/static/scss/hr_attendance_scss.scss b/yuthon_hr_attendance/static/scss/hr_attendance_scss.scss new file mode 100644 index 000000000..44d654a1a --- /dev/null +++ b/yuthon_hr_attendance/static/scss/hr_attendance_scss.scss @@ -0,0 +1,8 @@ +.list_width{ + width: 30px; + max-width: 30px; +} +.list_ids_width{ + width: 30px !important; + max-width: 30px !important; +} \ No newline at end of file diff --git a/yuthon_hr_attendance/views/card_approval.xml b/yuthon_hr_attendance/views/card_approval.xml index 8d5ef5b93..bbf0eb827 100644 --- a/yuthon_hr_attendance/views/card_approval.xml +++ b/yuthon_hr_attendance/views/card_approval.xml @@ -18,6 +18,11 @@
+
+

+ +

+
@@ -35,7 +40,6 @@ - @@ -45,7 +49,6 @@ - 补卡 card.approval diff --git a/yuthon_hr_attendance/views/go_approval.xml b/yuthon_hr_attendance/views/go_approval.xml index f2af2ec52..1769410e5 100644 --- a/yuthon_hr_attendance/views/go_approval.xml +++ b/yuthon_hr_attendance/views/go_approval.xml @@ -46,10 +46,11 @@ - + + + + - - diff --git a/yuthon_hr_attendance/views/hr_attendance_views.xml b/yuthon_hr_attendance/views/hr_attendance_views.xml index 8e97c93c9..bda5d2729 100644 --- a/yuthon_hr_attendance/views/hr_attendance_views.xml +++ b/yuthon_hr_attendance/views/hr_attendance_views.xml @@ -9,16 +9,17 @@ decoration-danger="is_abnormal"> + - - - - + + + + + - - + - +