添加功能

This commit is contained in:
李鹏宇
2026-09-02 17:16:20 +08:00
parent 1e883fb91e
commit 2fdf2d06d4
5 changed files with 72 additions and 5 deletions
@@ -1,6 +1,9 @@
# -*- coding: utf-8 -*-
import logging
import datetime
from Tools.scripts.dutree import store
from odoo import models, fields, api, _, modules
from odoo.exceptions import ValidationError, UserError
@@ -117,15 +120,14 @@ class SoongWorkflowEntrust(models.Model):
@api.depends('start_date', 'end_date', 'is_expiration_date')
def compute_is_enable(self):
today = fields.Date.today()
for rec in self:
if rec.is_expiration_date:
rec.is_enable = True
elif rec.start_date and rec.end_date:
rec.is_enable = rec.start_date <= today < rec.end_date
else:
if rec.start_date and rec.end_date:
if rec.start_date <= fields.Date.today() < rec.end_date:
rec.is_enable = True
else:
rec.is_enable = False
rec.is_enable = False
class EntrustAll(models.Model):
+1
View File
@@ -27,6 +27,7 @@
'views/issue_meeting_minutes_views.xml',
'views/issue_party_approval_views.xml',
'views/issue_library_type_views.xml',
'views/role_group_views.xml',
'wizard/issue_line_add_wizard.xml',
'wizard/soong_workflow_comment_wizard_inherit.xml',
'report/meeting_minutes_report.xml',
+1
View File
@@ -12,4 +12,5 @@ from . import issue_party_approval
from . import issue_class_approval
from . import issue_boss_approval
from . import soong_workflow_mixin_inherit
from . import role_group_inherit
+32
View File
@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
from odoo import api, fields, models
class SoongUserRoleGroupInherit(models.Model):
_inherit = 'soong.user.role.group'
personnel_ids = fields.Many2many(
'hr.employee',
'yuthon_issue_role_group_personnel_rel',
'group_id',
'employee_id',
string='人员',
compute='_compute_personnel',
)
@api.depends('user_role_ids')
def _compute_personnel(self):
# 与议题模块「列席群组」取人逻辑保持一致:
# 群组包含角色(user_role_ids)中,任一角色作为员工主角色(user_role_id)
# 或辅助角色(user_role_ids)时,该员工即列为列席人员
for group in self:
if group.user_role_ids:
role_ids = group.user_role_ids.ids
employees = self.env['hr.employee'].sudo().search([
'|',
('user_role_id', 'in', role_ids),
('user_role_ids', 'in', role_ids),
])
group.personnel_ids = employees
else:
group.personnel_ids = self.env['hr.employee']
+31
View File
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- 列席群组「搜索更多」列表:只显示 角色名称 / 角色说明 / 人员,其余列隐藏 -->
<record id="view_soong_user_role_group_tree_inherit_personnel" model="ir.ui.view">
<field name="name">soong.user.role.group.tree.inherit.personnel</field>
<field name="model">soong.user.role.group</field>
<field name="inherit_id" ref="soong_workflow.view_soong_user_role_group_tree"/>
<field name="arch" type="xml">
<!-- 隐藏不需要的列 -->
<xpath expr="//field[@name='number']" position="attributes">
<attribute name="column_invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='start_date']" position="attributes">
<attribute name="column_invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='end_date']" position="attributes">
<attribute name="column_invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='create_date']" position="attributes">
<attribute name="column_invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='company_id']" position="attributes">
<attribute name="column_invisible">1</attribute>
</xpath>
<!-- 在角色说明后插入「人员」列 -->
<xpath expr="//field[@name='user_note']" position="after">
<field name="personnel_ids" widget="many2many_tags" string="人员" options="{'no_create': True}"/>
</xpath>
</field>
</record>
</odoo>