添加功能

This commit is contained in:
李鹏宇
2026-01-26 16:29:00 +08:00
parent 3dd662a9ad
commit d3ddf7b679
5 changed files with 37 additions and 9 deletions
@@ -425,7 +425,7 @@
'check_employee': 1}
</field>
<field name="domain">[('users_ids', 'in', uid), ('reclaim_state', '=', False), ('soong_state', 'in',
['done', 'active']), ('is_company', '=', True)]
['done', 'active'])]
</field>
<field name="search_view_id" ref="soong_workflow_record_search1"/>
<field name="view_id" ref="soong_workflow_record_done_tree"/>
@@ -35,7 +35,6 @@ class YuthonFileProcessing(models.Model):
string="抄送单位"
)
department_ids = fields.Many2many('hr.department', string='部门范围')
employee_ids = fields.Many2many('hr.employee', string='人员范围')
users_role_ids = fields.Many2many('soong.user.role', string='角色范围')
servings_number = fields.Integer(string="份数")
@@ -65,7 +64,7 @@ class YuthonFileProcessing(models.Model):
red_suit = fields.Char(string="套红")
official_documents_ids = fields.Many2many('ir.attachment', string="附件")
completion_time = fields.Datetime(string="办结时间")
is_supervising = fields.Boolean(string="是否督办")
deadline = fields.Datetime(string="办理期限")
done_date = fields.Date(string="完成时间")
@@ -74,6 +73,18 @@ class YuthonFileProcessing(models.Model):
issue_library_ids = fields.One2many('issue.library', 'yuthon_official_id', string="议题关联")
work_end = fields.Boolean(string="结束")
official_state = fields.Selection([('to_do', '待转'), ('done', '已转')], string="状态")
employee_ids1 = fields.Many2many(
'hr.employee',
'yuthon_file_processing_employee1_rel',
'file_id', 'employee_id',
string="经办人"
)
employee_ids = fields.Many2many(
'hr.employee',
'yuthon_file_processing_employee_rel',
'file_id', 'employee_id',
string='人员范围'
)
def _get_default_name_title(self):
return self._description if self._description else self._name
@@ -88,7 +99,7 @@ class YuthonFileProcessing(models.Model):
default=lambda self: [(6, 0, [self.env.user.id])]
)
users_ids = fields.Many2many('res.users',
string="当前经办人",
string="用户",
relation='yuthon_file_processing_users_rel',
column1='processing_id',
column2='compute_user_id',
@@ -144,15 +155,22 @@ class YuthonFileProcessing(models.Model):
record.users_ids = False
record.approve_state = False
record.soong_state = False
record.employee_id = False
workflow = self.env['soong.workflow.record'].sudo().search(
[('code', '=', record.code)],
limit=1
)
if workflow:
record.users_ids = workflow.employee_ids.mapped('user_id')
record.employee_ids1 = workflow.employee_id.ids
record.users_ids = workflow.users_ids.ids
record.approve_state = workflow.approve_state
record.soong_state = workflow.soong_state
if record.log_ids:
record.completion_time = record.log_ids[-1].lase_click_date
else:
record.completion_time = False
@api.onchange('is_cold')
def onchange_is_cold(self):
if self.is_cold:
@@ -29,6 +29,7 @@ class YuthonSubEnterprises(models.Model):
default='normal')
work_end = fields.Boolean(string="结束")
employee_ids = fields.Many2many('hr.employee', string="经办人")
completion_time = fields.Datetime(string="办结时间")
def _get_default_name_title(self):
return self._description if self._description else self._name
@@ -103,6 +104,11 @@ class YuthonSubEnterprises(models.Model):
record.approve_state = workflow.approve_state
record.soong_state = workflow.soong_state
if record.log_ids:
record.completion_time = record.log_ids[-1].lase_click_date
else:
record.completion_time = False
def compute_workflow(self):
enterprises_ids = self.env["yuthon.sub.enterprises"].browse(
self._context.get('active_ids', self._context.get('active_id')))
@@ -8,7 +8,9 @@
<field name="code"/>
<field name="name"/>
<field name="approve_state" widget="badge" decoration-danger="approve_state == 'end'" decoration-success="approve_state == 'pending'"/>
<field name="users_ids" widget="many2many_tags"/>
<field name="employee_ids1" widget="many2many_tags"/>
<field name="users_ids" widget="many2many_tags" column_invisible="1"/>
<field name="completion_time"/>
<field name="soong_state"/>
</tree>
</field>
@@ -7,10 +7,12 @@
<tree string="文件处理(子企业)">
<field name="code"/>
<field name="name"/>
<field name="approve_state" widget="badge" decoration-danger="approve_state == 'end'" decoration-success="approve_state == 'pending'"/>
<field name="approve_state" widget="badge" decoration-danger="approve_state == 'end'"
decoration-success="approve_state == 'pending'"/>
<field name="employee_ids" widget="many2many_tags"/>
<field name="users_ids" widget="many2many_tags" column_invisible="1"/>
<field name="soong_state"/>
<field name="users_ids" widget="many2many_tags" column_invisible="1"/>
<field name="completion_time"/>
<field name="soong_state"/>
</tree>
</field>
</record>