添加功能

This commit is contained in:
zhou
2025-07-12 17:38:01 +08:00
parent 22678198be
commit f02f34b766
6 changed files with 36 additions and 9 deletions
@@ -6,7 +6,7 @@ from odoo.exceptions import ValidationError
class YuthonVacationReports(models.Model):
_name = 'yuthon.vacation.reports'
_description = '假期报表'
_description = '假期额度记录'
employee_id = fields.Many2one('hr.employee', string='员工')
company_id = fields.Many2one(related="employee_id.company_id", string="公司")
@@ -131,7 +131,7 @@ class VacationLeaveLine(models.Model):
_name = 'vacation.leave.line'
_description = '年假明细'
vacation_id = fields.Many2one('yuthon.vacation.reports', string='关联假期报表')
vacation_id = fields.Many2one('yuthon.vacation.reports', string='关联假期额度记录')
workflow_record_id = fields.Many2one('soong.workflow.record', string='流程')
update_type= fields.Selection([('add', '增加'), ('reduce', '减少')], string='更新类型')
update_date = fields.Date(string='更新时间')
@@ -161,7 +161,7 @@ class VacationOverline(models.Model):
_name = 'vacation.over.line'
_description = '加班明细'
vacation_id = fields.Many2one('yuthon.vacation.reports', string='关联假期报表')
vacation_id = fields.Many2one('yuthon.vacation.reports', string='关联假期额度记录')
workflow_record_id = fields.Many2one('soong.workflow.record', string='流程')
update_type= fields.Selection([('add', '增加'), ('reduce', '减少')], string='更新类型')
workday = fields.Float(string='工作日')
@@ -207,7 +207,7 @@ class VacationMealLine(models.Model):
_name = 'vacation.meal.line'
_description = '误餐明细'
vacation_id = fields.Many2one('yuthon.vacation.reports', string='关联假期报表')
vacation_id = fields.Many2one('yuthon.vacation.reports', string='关联假期额度记录')
workflow_record_id = fields.Many2one('soong.workflow.record', string='流程')
update_type= fields.Selection([('add', '增加'), ('reduce', '减少')], string='更新类型')
update_date = fields.Date(string='更新时间')
@@ -14,7 +14,7 @@
<field name="implied_ids" eval="[(4, ref('group_yuthon_holiday_user'))]"/>
</record>
<record model="ir.rule" id="yuthon_vacation_reports_rule">
<field name="name">假期报表多公司</field>
<field name="name">假期额度记录多公司</field>
<field name="model_id" ref="model_yuthon_vacation_reports"/>
<field name="domain_force">[('company_id', 'in', company_ids)]</field>
</record>
@@ -4,7 +4,7 @@
<field name="name">yuthon.vacation.reports.tree</field>
<field name="model">yuthon.vacation.reports</field>
<field name="arch" type="xml">
<tree string="假期报表" editable="bottom">
<tree string="假期额度记录" editable="bottom">
<field name="employee_id" options="{'no_create': True}"/>
<field name="leave"/>
<field name="working_overtime"/>
@@ -19,7 +19,7 @@
<field name="name">yuthon.vacation.reports.form</field>
<field name="model">yuthon.vacation.reports</field>
<field name="arch" type="xml">
<form string="假期报表">
<form string="假期额度记录">
<sheet>
<notebook>
<page string="年假">
@@ -70,10 +70,16 @@
</field>
</record>
<record id="view_yuthon_vacation_reports_action" model="ir.actions.act_window">
<field name="name">假期报表</field>
<field name="name">假期额度记录</field>
<field name="res_model">yuthon.vacation.reports</field>
<field name="view_mode">tree,form</field>
</record>
<record id="view_yuthon_vacation_reports_my_action" model="ir.actions.act_window">
<field name="name">我的假期额度</field>
<field name="res_model">yuthon.vacation.reports</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('employee_id.user_id', '=', uid)]</field>
</record>
<record id="all_update_employee" model="ir.actions.server">
<field name="name">更新报表</field>
<field name="model_id" ref="yuthon_holiday.model_yuthon_vacation_reports"/>
@@ -51,9 +51,21 @@ class HrAttendance(models.Model):
approval_check_in = fields.Datetime(string="修正前上班打卡时间")
approval_check_out = fields.Datetime(string="修正前下班打卡时间")
is_workflow = fields.Boolean(string="是否是流程", default=False)
workflow_id = fields.Many2one('soong.workflow.record', string="流程", compute='_compute_workflow', store=True)
is_month = fields.Boolean(string="是否为本月数据", compute='_compute_month_status', store=True)
is_last_month = fields.Boolean(string="是否为上月数据", compute='_compute_month_status', store=True)
def button_workflow(self):
self.ensure_one()
return {
'name': '流程',
'type': 'ir.actions.act_window',
'view_mode': 'tree',
'res_model': 'soong.workflow.record',
'domain': [('id', '=', self.workflow_id.id)],
}
@api.depends('current_data')
def _compute_month_status(self):
today = fields.Date.today()
@@ -6,6 +6,7 @@
<field name="arch" type="xml">
<tree string="出勤"
edit="false" delete="false" create="false"
decoration-danger="is_workflow"
editable="bottom" limit="20">
<header>
<!-- <button name="compute_company_id" string="公司更新" type="object" class="btn btn-primary"/>-->
@@ -33,9 +34,12 @@
<field name="is_approval" optional="hidden"/>
<field name="is_check_in_red" column_invisible="1"/>
<field name="is_check_out_red" column_invisible="1"/>
<field name="is_workflow" optional="hidden"/>
<field name="workflow_id" optional="hidden"/>
<button name="button_controls_wizard" type="object" string="操作" class="oe_highlight" invisible="not (is_abnormal or is_early_card or is_late_card or absenteeism_card or is_no_card)"/>
<button name="button_correct_wizard" type="object" string="修正" class="btn btn-primary" invisible="not (is_abnormal or is_early_card or is_late_card or absenteeism_card or is_no_card)" groups="yuthon_hr_attendance.group_he_attendance_sign_manager"/>
<button name="revoke" type="object" string="撤销" class="btn btn-primary" invisible="not is_check_out_red or is_check_in_red" groups="yuthon_hr_attendance.group_he_attendance_sign_manager"/>
<button name="button_workflow" type="object" string="流程" class="oe_highlight" invisible="not is_workflow"/>
<button name="button_source" type="object" string="详情" class="oe_highlight" groups="yuthon_hr_attendance.group_he_attendance_sign_manager"/>
</tree>
</field>
+6 -1
View File
@@ -160,7 +160,7 @@
<!-- action="hr_holidays.hr_leave_allocation_action_my"-->
<!-- sequence="13"/>-->
<menuitem id="holiday_yuthon_vacation_reports_board"
name="假期报表"
name="假期额度记录"
parent="hr_attendance_root_board_menu"
action="yuthon_holiday.view_yuthon_vacation_reports_action"
sequence="14"/>
@@ -586,6 +586,11 @@
parent="holiday_manage_menu_root_board"
action="yuthon_hr_attendance.hr_attendance_action1"
sequence="5"/>
<menuitem id="yuthon_vacation_reports_my"
name="我的假期额度"
parent="holiday_manage_menu_root_board"
action="yuthon_holiday.view_yuthon_vacation_reports_my_action"
sequence="7"/>
<menuitem id="menu_hr_attendance_month_my_detail"
name="考勤确认"
parent="holiday_manage_menu_root_board"