Merge pull request !684 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2024-12-08 09:10:41 +00:00
committed by Gitee
10 changed files with 116 additions and 20 deletions
+1
View File
@@ -25,6 +25,7 @@
'views/inherit_planning_role_views.xml',
'views/inherit_planning_slot_views.xml',
'views/inherit_planning_slot_template_views.xml',
'views/yuthon_customer_approval_views.xml',
'views/yuthon_shift_planning_views.xml',
'views/yuthon_run_planning_views.xml',
'views/overtime_approval.xml',
+1
View File
@@ -14,3 +14,4 @@ from . import inherit_hr_employee
from . import yuthon_shift_planning
from . import yuthon_run_planning
from . import duty_approval
from . import yuthon_customer_approval
+16 -16
View File
@@ -65,22 +65,22 @@ class CardApprovals(models.Model):
rec.attendance_id.check_out = rec.attendance_id.check_in.replace(hour=max_hour, minute=max_minute) - timedelta(hours=8)
rec.attendance_id.is_approval = True
# @api.onchange('is_issues')
# def _onchange_is_issues(self):
# if self.is_issues:
# issue_id = self.env['issue.library'].create({'name': self.name})
# self.related_issues_id = issue_id.id
# workflow_record_id = self.env["soong.workflow.record"].search(
# [("res_model", "=", self._name), ("res_id", "=", self.id)])
# self.env['issue.library.approval.line'].create({
# 'issue_library_id': issue_id.id,
# 'workflow_record_id': workflow_record_id.id,
# 'approval_type': workflow_record_id.workflow_id.id,
# 'code': self.code,
# 'approval_date': fields.Datetime.now(),
# })
# elif self.related_issues_id:
# raise UserError("已经创建了相关的上会记录,不能取消勾选")
@api.onchange('is_issues')
def _onchange_is_issues(self):
if self.is_issues:
issue_id = self.env['issue.library'].create({'name': self.name})
self.related_issues_id = issue_id.id
workflow_record_id = self.env["soong.workflow.record"].search(
[("res_model", "=", self._name), ("res_id", "=", self.id)])
self.env['issue.library.approval.line'].create({
'issue_library_id': issue_id.id,
'workflow_record_id': workflow_record_id.id,
'approval_type': workflow_record_id.workflow_id.id,
'code': self.code,
'approval_date': fields.Datetime.now(),
})
elif self.related_issues_id:
raise UserError("已经创建了相关的上会记录,不能取消勾选")
@@ -5,7 +5,6 @@ from datetime import timedelta
from dateutil.relativedelta import relativedelta
from odoo.tools import format_datetime, format_duration
import logging
import re
_logger = logging.getLogger(__name__)
@@ -0,0 +1,39 @@
from odoo import api, fields, models, tools, _
from datetime import datetime, time, timedelta
from odoo.exceptions import UserError
class YuthonCustomerApproval(models.Model):
_name = 'yuthon.customer.approval'
_description = '客服值班审批'
_inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin']
_rec_name = 'name'
yuthon_company = fields.Selection(related='users_id.employee_id.yuthon_company', string="公司")
name = fields.Char(string="标题")
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('overtime_approval'))
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
employee_id = fields.Many2one(related='users_id.employee_id', string="员工")
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
is_issues = fields.Boolean(string='是否上会')
related_issues_id = fields.Many2one('issue.library', string="关联议题")
reason_application = fields.Html(string="申请事由")
documents_ids = fields.Many2many('ir.attachment', string="附件")
active = fields.Boolean('Active', default=True, tracking=True)
@api.onchange('is_issues')
def _onchange_is_issues(self):
if self.is_issues:
issue_id = self.env['issue.library'].create({'name': self.name})
self.related_issues_id = issue_id.id
workflow_record_id = self.env["soong.workflow.record"].search(
[("res_model", "=", self._name), ("res_id", "=", self.id)])
self.env['issue.library.approval.line'].create({
'issue_library_id': issue_id.id,
'workflow_record_id': workflow_record_id.id,
'approval_type': workflow_record_id.workflow_id.id,
'code': self.code,
'approval_date': fields.Datetime.now(),
})
elif self.related_issues_id:
raise UserError("已经创建了相关的上会记录,不能取消勾选")
@@ -21,4 +21,5 @@ access_yuthon_high_run_line,high.run.line,model_yuthon_high_run_line,base.group_
access_yuthon_all_run_line,all.run.line,model_yuthon_all_run_line,base.group_user,1,1,1,1
access_yuthon_other_line,yuthon.other.line,model_yuthon_other_line,base.group_user,1,1,1,1
access_yuthon_shift_ever_white_line,shift.ever.white.line,model_yuthon_shift_ever_white_line,base.group_user,1,1,1,1
access_yuthon_shift_ever_noon_line,shift.ever.noon.line,model_yuthon_shift_ever_noon_line,base.group_user,1,1,1,1
access_yuthon_shift_ever_noon_line,shift.ever.noon.line,model_yuthon_shift_ever_noon_line,base.group_user,1,1,1,1
access_yuthon_customer_approval,yuthon.customer.approval,model_yuthon_customer_approval,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
21 access_yuthon_shift_ever_noon_line shift.ever.noon.line model_yuthon_shift_ever_noon_line base.group_user 1 1 1 1
22 access_yuthon_customer_approval yuthon.customer.approval model_yuthon_customer_approval base.group_user 1 1 1 1
23
24
25
+1 -1
View File
@@ -13,7 +13,7 @@
</field>
</record>
<record id="card_approval_form" model="ir.ui.view">
<field name="name">card.approval.actions</field>
<field name="name">card.approval.form</field>
<field name="model">card.approval</field>
<field name="arch" type="xml">
<form>
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="yuthon_customer_tree_view" model="ir.ui.view">
<field name="name">yuthon.customer.tree.views</field>
<field name="model">yuthon.customer.approval</field>
<field name="arch" type="xml">
<tree string="客服值班审批">
<field name="name"/>
<field name="users_id"/>
</tree>
</field>
</record>
<record id="yuthon_customer_form_view" model="ir.ui.view">
<field name="name">yuthon.customer.form.views</field>
<field name="model">yuthon.customer.approval</field>
<field name="arch" type="xml">
<form string="客服值班审批">
<sheet>
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name" required="1"/>
</h1>
</div>
<group string="个人信息" col="2">
<group>
<field name="users_id"/>
<field name="employee_id" invisible="1"/>
<field name="is_issues"/>
<field name="related_issues_id" invisible="not is_issues"/>
</group>
<group>
<field name="yuthon_company"/>
<field name="department_id" invisible="1"/>
</group>
</group>
<group string="审批事项">
<field name="reason_application"/>
<field name="documents_ids" widget="preview_many2many"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="action_yuthon_customer_approval" model="ir.actions.act_window">
<field name="name">客服值班审批</field>
<field name="res_model">yuthon.customer.approval</field>
<field name="view_mode">tree,form</field>
</record>
</odoo>
@@ -5,6 +5,6 @@ class HrPayrollStructureType(models.Model):
_inherit = 'hr.payroll.structure.type'
_description = '职级类别'
name = fields.Char(string='职级类行', required=True)
name = fields.Char(string='职级类型', required=True)
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')],
string='所属公司')
@@ -274,6 +274,11 @@
parent="menu_hr_attendance_approval_request_board"
sequence="13"
action="yuthon_hr_attendance.approval_request_card"/>
<menuitem id="menu_hr_customer_approval_board"
name="客户值班审批"
parent="menu_hr_attendance_approval_request_board"
sequence="17"
action="yuthon_hr_attendance.action_yuthon_customer_approval"/>
<menuitem id="attendance_resources_setting_root_board"
name="配置"
parent="hr_attendance_root_board"