This commit is contained in:
夜未央
2025-08-05 17:05:47 +08:00
6 changed files with 194 additions and 56 deletions
@@ -2,7 +2,7 @@
<odoo>
<template id="soong_workflow_log_manager">
<notebook>
<page string="审批详情,正常-显示退回" invisible="work_end">
<page string="审批详情" invisible="work_end">
<field name="log_ids" style="width:100%%; margin-top: 10px;">
<tree editable="bottom">
<field name="sequence" string="" widget="handle" groups="soong_workflow.group_soong_workflow_manager"/>
@@ -8,6 +8,7 @@ class YuthonVacationReports(models.Model):
_name = 'yuthon.vacation.reports'
_description = '假期额度记录'
_rec_name = "employee_id"
_order = "vacation_date desc"
employee_id = fields.Many2one('hr.employee', string='员工')
department_id = fields.Many2one(related='employee_id.department_id', string="部门")
@@ -19,10 +20,79 @@ class YuthonVacationReports(models.Model):
other_fee_ids = fields.One2many('vacation.other.line', 'vacation_id', string='其他明细')
vacation_date = fields.Date(string='日期', default=lambda self: fields.Date.today())
leave = fields.Char(string='年假', compute='_compute_leave', store=True)
leave = fields.Char(string='年假', compute='_compute_leave', store=True, digits=(16, 3))
working_overtime = fields.Char(string='加班时', compute='_compute_working_overtime', store=True)
meal_fee = fields.Integer(string="误餐次数", compute='_compute_meal_fee', store=True)
medical_fee = fields.Float(string="体检费", compute='_compute_medical_fee', store=True)
compensatory_leave = fields.Integer(string="调休")
leave_of_absence = fields.Integer(string="事假", digits=(16, 3))
statutory_leave = fields.Integer(string="法定假")
cop_leave = fields.Float(string='补休', digits=(16, 3))
duty_off_leave = fields.Integer(string='值班调休')
marriage_leave = fields.Integer(string='婚假')
maternity_leave = fields.Integer(string='产假')
paternity_leave = fields.Integer(string='陪产假')
family_planning_leave = fields.Integer(string='计生假')
bereavement_leave = fields.Float(string='丧假')
home_visit_leave = fields.Integer(string='探亲假')
parents_meeting_leave = fields.Integer(string='家长会假')
general_sick_leave = fields.Float(string='病假(普通)')
hospital_sick_leave = fields.Float(string='病假(住院期)')
recovery_sick_leave = fields.Float(string='病假(出院恢复期)')
exam_leave = fields.Integer(string='考试假')
come_late = fields.Integer(string="迟到")
is_early_card = fields.Integer(string="早退")
is_no_card = fields.Integer(string="缺卡")
is_work = fields.Integer(string='旷工')
vacation_state = fields.Selection(
selection=[
('unconfirmed', "未确认"),
('confirmed', "已确认"),
('pending', "待定"),
],
string="状态",
readonly=True, copy=False, index=True,
tracking=3,
default='unconfirmed')
def button_put(self):
menu_id = self.env['ir.ui.menu'].search([('name', '=', '考勤确认'), ('parent_id', '!=', False)])
url = f'https://oa.thtzjt.com/web#id={self.id}&cids=2&action={menu_id.action.id}&model=hr.attendance.month.detail&view_type=list&menu_id={menu_id.id}'
we_id = self.env['hr.employee'].search([('id', '=', self.employee_id.id)]).wecom_userid
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='default', user_id=we_id, title="考勤确认",
description=self.employee_id.name + '请确认你的考勤:',
url=url, btntxt="详细信息")
return {
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'type': 'success',
'message': '确认通知已发送',
'sticky': False,
}
}
def button_all_put(self):
detail_ids = self.env["yuthon.vacation.reports"].browse(self._context.get('active_ids', self._context.get('active_id')))
unique_employee_ids = list({detail.employee_id.id for detail in detail_ids if detail.employee_id})
for employee_id in unique_employee_ids:
menu_id = self.env['ir.ui.menu'].search([('name', '=', '考勤确认'), ('parent_id', '!=', False)])
url = f'https://oa.thtzjt.com/web#id={self.id}&cids=2&action={menu_id.action.id}&model=hr.attendance.month.detail&view_type=list&menu_id={menu_id.id}'
we_id = self.env['hr.employee'].search([('id', '=', employee_id)]).wecom_userid
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='attendance', user_id=we_id, title="考勤确认",
description=employee_id.name + '请确认你的考勤:',
url=url, btntxt="详细信息")
return {
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'type': 'success',
'message': '确认通知已发送',
'sticky': False,
}
}
@api.depends('medical_fee_ids.update_type', 'medical_fee_ids.lines', 'medical_fee_ids.is_void')
def _compute_medical_fee(self):
@@ -172,7 +242,6 @@ class YuthonVacationReports(models.Model):
overtime_hours += line_total
elif line.update_type == 'reduce':
overtime_hours -= line_total
overtime_days = overtime_hours / 8
record.working_overtime = f"{overtime_hours:.2f}小时({overtime_days:.2f}天)"
@@ -188,34 +257,6 @@ class YuthonVacationReports(models.Model):
meal_total -= int(line.update_lines or 0)
record.meal_fee = meal_total
def button_fixes_approval(self):
form_id = self.env.ref('yuthon_holiday.view_yuthon_fixes_approval_form').id
return {
"type": "ir.actions.act_window",
"name": "修正申请",
"res_model": "yuthon.fixes.approval",
"views": [[form_id, "form"]],
"context": {
'default_users_id': self.employee_id.user_id.id,
'default_vacation_id': self.id,
'default_now_type': 'hours',
'default_holiday_status': 'annual'
}
}
def vacation_details(self):
domain =[('workflow_id.name', 'in', ['请假', '加班', '外出']), ('create_uid', '=', self.employee_id.user_id.id)]
action = {
'name': '审批详情',
'type': 'ir.actions.act_window',
'res_model': 'soong.workflow.record',
'view_mode': 'tree',
'domain': domain,
'context': {'group_by': ['workflow_id'],
'tree_view_ref':'yuthon_holiday.details_tree_view',
}}
return action
def update_vacation(self):
employees = self.env['hr.employee'].search([
('is_salary', '=', True),
@@ -4,15 +4,39 @@
<field name="name">yuthon.vacation.reports.tree</field>
<field name="model">yuthon.vacation.reports</field>
<field name="arch" type="xml">
<tree string="假期额度日志" editable="bottom" edit="0">
<field name="employee_id" options="{'no_create': True}"/>
<tree string="假期额度记录" editable="bottom" edit="0">
<field name="employee_id" options="{'no_open': True}"/>
<field name="department_id" optional="hide"/>
<field name="company_id" optional="hide"/>
<field name="vacation_date" optional="hide"/>
<field name="come_late"/>
<field name="is_early_card"/>
<field name="is_no_card"/>
<field name="is_work"/>
<field name="leave"/>
<field name="working_overtime"/>
<field name="meal_fee"/>
<field name="company_id" optional="hide"/>
<field name="vacation_date"/>
<button name="button_fixes_approval" string="修正" type="object" class="oe_highlight"/>
<button name="log" string="日志" type="object" class="oe_highlight"/>
<field name="medical_fee"/>
<field name="compensatory_leave"/>
<field name="leave_of_absence"/>
<field name="statutory_leave"/>
<field name="cop_leave"/>
<field name="duty_off_leave"/>
<field name="marriage_leave"/>
<field name="maternity_leave"/>
<field name="paternity_leave"/>
<field name="family_planning_leave"/>
<field name="bereavement_leave"/>
<field name="home_visit_leave"/>
<field name="parents_meeting_leave"/>
<field name="general_sick_leave"/>
<field name="hospital_sick_leave"/>
<field name="recovery_sick_leave"/>
<field name="exam_leave"/>
<field name="vacation_state" widget="badge" decoration-info="vacation_state == 'unconfirmed'"
decoration-success="vacation_state == 'confirmed'"/>
<button name="log" type="object" string="详情" class="oe_highlight"/>
<button name="button_put" string="发送" type="object" class="oe_highlight"/>
</tree>
</field>
</record>
@@ -20,14 +44,39 @@
<field name="name">yuthon.vacation.my.reports.tree</field>
<field name="model">yuthon.vacation.reports</field>
<field name="arch" type="xml">
<tree string="我的假期额度日志" editable="bottom" edit="0">
<field name="employee_id" options="{'no_create': True}"/>
<field name="department_id"/>
<tree string="我的假期额度记录" editable="bottom">
<field name="employee_id" options="{'no_open': True}"/>
<field name="department_id" optional="hide"/>
<field name="company_id" optional="hide"/>
<field name="vacation_date" optional="hide"/>
<field name="come_late"/>
<field name="is_early_card"/>
<field name="is_no_card"/>
<field name="is_work"/>
<field name="leave"/>
<field name="working_overtime"/>
<field name="meal_fee"/>
<field name="vacation_date"/>
<field name="company_id" optional="hide"/>
<field name="medical_fee"/>
<field name="compensatory_leave"/>
<field name="leave_of_absence"/>
<field name="statutory_leave"/>
<field name="cop_leave"/>
<field name="duty_off_leave"/>
<field name="marriage_leave"/>
<field name="maternity_leave"/>
<field name="paternity_leave"/>
<field name="family_planning_leave"/>
<field name="bereavement_leave"/>
<field name="home_visit_leave"/>
<field name="parents_meeting_leave"/>
<field name="general_sick_leave"/>
<field name="hospital_sick_leave"/>
<field name="recovery_sick_leave"/>
<field name="exam_leave"/>
<field name="vacation_state" widget="badge" decoration-info="vacation_state == 'unconfirmed'"
decoration-success="vacation_state == 'confirmed'"/>
<button name="log" type="object" string="详情" class="oe_highlight"/>
<button name="button_put" string="发送" type="object" class="oe_highlight"/>
</tree>
</field>
</record>
@@ -142,6 +191,30 @@
</tree>
</field>
</page>
<page string="汇总" invisible="1">
<group>
<field name="come_late"/>
<field name="is_early_card"/>
<field name="is_no_card"/>
<field name="is_work"/>
<field name="compensatory_leave"/>
<field name="leave_of_absence"/>
<field name="statutory_leave"/>
<field name="cop_leave"/>
<field name="duty_off_leave"/>
<field name="marriage_leave"/>
<field name="maternity_leave"/>
<field name="paternity_leave"/>
<field name="family_planning_leave"/>
<field name="bereavement_leave"/>
<field name="home_visit_leave"/>
<field name="parents_meeting_leave"/>
<field name="general_sick_leave"/>
<field name="hospital_sick_leave"/>
<field name="recovery_sick_leave"/>
<field name="exam_leave"/>
</group>
</page>
</notebook>
</sheet>
</form>
@@ -259,6 +332,30 @@
</tree>
</field>
</page>
<page string="汇总" invisible="1">
<group>
<field name="come_late"/>
<field name="is_early_card"/>
<field name="is_no_card"/>
<field name="is_work"/>
<field name="compensatory_leave"/>
<field name="leave_of_absence"/>
<field name="statutory_leave"/>
<field name="cop_leave"/>
<field name="duty_off_leave"/>
<field name="marriage_leave"/>
<field name="maternity_leave"/>
<field name="paternity_leave"/>
<field name="family_planning_leave"/>
<field name="bereavement_leave"/>
<field name="home_visit_leave"/>
<field name="parents_meeting_leave"/>
<field name="general_sick_leave"/>
<field name="hospital_sick_leave"/>
<field name="recovery_sick_leave"/>
<field name="exam_leave"/>
</group>
</page>
</notebook>
</sheet>
</form>
@@ -296,6 +393,13 @@
<field name="binding_model_id" ref="yuthon_holiday.model_yuthon_vacation_reports"/>
<field name="state">code</field>
<field name="code">action = model.update_log()</field>
</record>
<record id="all_data_attendance_put_month" model="ir.actions.server">
<field name="name">批量发送</field>
<field name="model_id" ref="yuthon_holiday.model_yuthon_vacation_reports"/>
<field name="binding_model_id" ref="yuthon_holiday.model_yuthon_vacation_reports"/>
<field name="state">code</field>
<field name="code">action = model.update_log()</field>
</record>
<record id="all_vacation_delete" model="ir.actions.server">
<field name="name">清零</field>
@@ -108,7 +108,6 @@
<button name="workflow_record" string="流程" type="object" class="oe_highlight"/>
<button name="details_record" string="详情" type="object" class="oe_highlight"/>
<button name="button_put" string="发送" type="object" class="oe_highlight"/>
</tree>
</field>
</record>
+2 -8
View File
@@ -7,20 +7,14 @@
<div class="page">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="equipment">
<div class="o_label_sheet" style="width:45mm;height:18mm;" >
<div class="o_label_full" style="width:45mm;height:18mm;">
<div class="o_label_sheet" style="width:18mm;height:18mm;" >
<div class="o_label_full" style="width:18mm;height:18mm;">
<div class="text-start o_label_small_barcode" style="float:left;margin-top:2px;width: 17mm;height: 17mm">
<t t-if="equipment.h5_url">
<img t-att-src="image_data_uri(equipment.h5_url_qrcode)" width="60" height="60"
style="padding:0;margin:0;display:block"/>
</t>
</div>
<div class="label-info"
style="float: left;font-size: 10px;padding-left:4px;margin-top:40px;width:26mm">
<div>
SN: <t t-esc="equipment.serial_no or 'N/A'"/>
</div>
</div>
</div>
</div>
</t>
+5 -5
View File
@@ -632,11 +632,11 @@
parent="holiday_manage_menu_root_board"
action="yuthon_holiday.action_server_open_my_vacation_form1"
sequence="7"/>
<menuitem id="menu_hr_attendance_month_my_detail"
name="考勤确认"
parent="holiday_manage_menu_root_board"
sequence="10"
action="yuthon_hr_attendance.hr_attendance_month_my_detail_action"/>
<!-- <menuitem id="menu_hr_attendance_month_my_detail"-->
<!-- name="我的考勤确认"-->
<!-- parent="holiday_manage_menu_root_board"-->
<!-- sequence="10"-->
<!-- action="yuthon_hr_attendance.hr_attendance_month_my_detail_action"/>-->
<menuitem id="salary_view_my_payslip_board"
name="我的薪资"
parent="holiday_manage_menu_root_board"