diff --git a/soong_workflow/models/soong_workflow.py b/soong_workflow/models/soong_workflow.py index b5ea51672..f3bb05a2e 100644 --- a/soong_workflow/models/soong_workflow.py +++ b/soong_workflow/models/soong_workflow.py @@ -39,15 +39,13 @@ class SoongWorkflow(models.Model): ] name = fields.Char(string="Name", help="Give workflow a name.") - model_id = fields.Many2one("ir.model", string="Model", domain=MODEL_DOMAIN, - help="Enter business model you would like to modify its workflow.", ) + model_id = fields.Many2one("ir.model", string="Model", domain=MODEL_DOMAIN, help="Enter business model you would like to modify its workflow.", ) node_ids = fields.One2many(comodel_name="soong.workflow.node", inverse_name="workflow_id", string="Nodes") link_ids = fields.One2many(comodel_name="soong.workflow.link", inverse_name="workflow_id", string="Links") remove_default_btn_until_end = fields.Boolean(string="是否覆盖表头按钮状态", default=False) - current_stage_highlight_color = fields.Char(default="rgb(0, 255, 255)", - help="The color to highlight the current stage on flow", ) + current_stage_highlight_color = fields.Char(default="rgb(0, 255, 255)", help="The color to highlight the current stage on flow", ) start_date = fields.Date(string="生效日期", copy=False, default=fields.Date.today()) - end_date = fields.Date(string="失效日期", copy=False) + end_date = fields.Date(string="失效日期", copy=False, default=fields.Date.from_string('2099-01-01')) is_enable = fields.Boolean(string="是否启用", default="False", compute="compute_is_enable", store=True) is_enable_return_button = fields.Boolean(string="是否启用收回", default=True) is_enable_transmitted_button = fields.Boolean(string="是否启用转交", default=True) @@ -149,7 +147,7 @@ class SoongWorkflow(models.Model): if not val["node_ids"]: val["node_ids"] = [ (0, 0, { - "name": _("经办人"), + "name": _("拟办"), "sequence": 1, "node_name": "start", "flow_start": True, diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py index 4438df718..9f2a0e5a0 100644 --- a/soong_workflow/models/soong_workflow_mixin.py +++ b/soong_workflow/models/soong_workflow_mixin.py @@ -152,9 +152,9 @@ class SoongWorkflowMixin(models.AbstractModel): def _add_comment(self, logs, btn_rec): wizard = self.env.ref("soong_workflow.view_soong_workflow_comment_wizard") # 状态列表 - state_list = ['经办人' if i.node_name == 'start' else i.node_name for i in btn_rec.node_id.workflow_id.node_ids] + state_list = ['拟办' if i.node_name == 'start' else i.node_name for i in btn_rec.node_id.workflow_id.node_ids] # 当前节点状态 - self_state = state_list.index('经办人' if self.state == 'start' else self.state) + self_state = state_list.index('拟办' if self.state == 'start' else self.state) self.env['trans.link'].search([]).unlink() if btn_rec.name == '转交' and len(btn_rec.node_id.out_link_ids) > 1: for state in btn_rec.node_id.out_link_ids: @@ -266,54 +266,31 @@ class SoongWorkflowMixin(models.AbstractModel): # 收回 def action_withdraw(self): - # 收回目前只支持指定用户和指定角色 for record in self: - # 角色 employee_id = self.env['hr.employee'] - result_dict = {} - # 获得到每一条记录的按钮权限 - i = 1 - for user in record.workflow_id.node_ids: - user_list = [] - transmitted = user.button_ids.search([('name', '=', '转交'), ('node_id', '=', user.id)]) - if transmitted.review_type == 'individual': # 指定用户 - user_list.append(transmitted.reviewer_id.id) - if transmitted.review_type == 'user_role': # 指定角色 - # 全局角色 - if transmitted.users_role_id.user_type == 'system_global_user': - # 所有的部门经理(全局角色) - role_user_ids = employee_id.search([('user_role_id', '=', transmitted.users_role_id.id)]) - for role_user in role_user_ids: - if self.env.user.employee_id.department_id.id == role_user.department_id.id: - user_list.append(role_user.user_id.id) # 角色的用户id - else: # 部门私有角色 - user_id = employee_id.search([('user_role_id', '=', transmitted.users_role_id.id)]).user_id.id - user_list.append(user_id) - user_name_i = f"{user.name}_{i}" - if user.name in result_dict: - result_dict[user_name_i].extend(user_list) + state_list = [] + for state in record.workflow_id.node_ids: + if state.name == '拟办': + state_list.append('start') + elif state.name == '结束': + state_list.append('end') else: - result_dict[user_name_i] = user_list - i += 1 - # 判断当前用户所在节点,与现在单据所在节点的位置,只有在等于1的时候,返回上一个状态,否则禁止操作 - for key in result_dict: - if key.startswith(self.state): - # 当前单据状态所在的位置 - record_number = key.split('_')[1] - for key, values in result_dict.items(): - if values != [False]: - if self.env.user.id in values: - # 当前用户所在节点 - user_number = key.split('_')[1] - user_key = key + state_list.append(state.name) + self_node_id = record.workflow_id.node_ids.search([('name', '=', self.state)]) + transmitted = self_node_id.button_ids.search([('name', '=', '转交'), ('node_id', '=', self_node_id.id)]) + if transmitted.btn_hide: + if transmitted.review_type == 'user_role': + user_ids_list = employee_id.search(['|', ('user_role_id', '=', transmitted.users_role_id.id), + ('user_role_ids', 'in', [transmitted.users_role_id.id])]).ids + if self.env.user.employee_id.id in user_ids_list: + raise UserError('当前节点不允许收回') + else: + state_index = state_list.index(self.state) + self.write({'state': state_list[state_index-1]}) else: - raise UserError('请配置节点的人员') - number = int(record_number) - int(user_number) - if number == 1: - self.write({'state': user_key.split('_')[0]}) + raise UserError('请配置节点角色') else: - raise UserError('不可收回') - + raise UserError('当前节点不允许收回') def _remove_default_header(self, view_type, res): """ diff --git a/soong_workflow/models/soong_workflow_node.py b/soong_workflow/models/soong_workflow_node.py index 7c113bc47..edbf8d2a8 100644 --- a/soong_workflow/models/soong_workflow_node.py +++ b/soong_workflow/models/soong_workflow_node.py @@ -94,8 +94,6 @@ class SoongWorkflowNode(models.Model): "name": _("转交"), "workflow_id": val['workflow_id'], "sequence": 1, - "action_type": "code", - "has_comment": True, },), (0, 0, { "name": _("收回"), @@ -369,7 +367,6 @@ class SoongWorkflowNodeButton(models.Model): # Run Proper Action func = getattr(self, "_run_%s" % rec.action_type) func_result = func() - # todo 触发下个流程消息发送 (写完未测试) try: user_ids = [] button_ids = rec.link_id.node_to.button_ids diff --git a/soong_workflow/views/soong_workflow_views.xml b/soong_workflow/views/soong_workflow_views.xml index 24276cd37..3c107e0b7 100644 --- a/soong_workflow/views/soong_workflow_views.xml +++ b/soong_workflow/views/soong_workflow_views.xml @@ -31,7 +31,7 @@ - + diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py index c84b2ef28..d58b88e22 100644 --- a/soong_workflow/wizard/soong_workflow_comment_wizard.py +++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py @@ -68,7 +68,7 @@ class SoongWorkflowCommentWizard(models.TransientModel): if self.node_link_len: record_id.write({'state': 'end' if self.trans_link_id.name == '结束' else self.trans_link_id.name}) if self.node_btn_name == '退回': - record_id.write({'state': 'start' if self.return_link_id.name == '经办人' else self.return_link_id.name}) + record_id.write({'state': 'start' if self.return_link_id.name == '拟办' else self.return_link_id.name}) # 填写审批记录 self.log_ids.write({"comment": self.comment_note_id.name}) return self.node_btn_id.with_context(cx).run() diff --git a/yuthon_notice/models/yuthon_notice.py b/yuthon_notice/models/yuthon_notice.py index 8a9a3f6e4..a3f01ed98 100644 --- a/yuthon_notice/models/yuthon_notice.py +++ b/yuthon_notice/models/yuthon_notice.py @@ -27,6 +27,7 @@ class YuthonNotice(models.Model): notice_documents_ids = fields.Many2many('documents.document', string="附件") is_notice_roger = fields.Selection([('yes', '已读'), ('no', '未读')], default='no', string="确认状态") is_change_notice = fields.Boolean(string="是否发送通知", default=True) + attn_notice = fields.Html(string="经办人意见") notice_text = fields.Html(string="正文") read_number = fields.Integer(string='阅读量', compute="_compute_read_number", store=True) approval_user_id = fields.Many2one('res.users', string="审核人") diff --git a/yuthon_notice/views/yuthon_notice_views.xml b/yuthon_notice/views/yuthon_notice_views.xml index 84d0d9a68..a2c7c4faf 100644 --- a/yuthon_notice/views/yuthon_notice_views.xml +++ b/yuthon_notice/views/yuthon_notice_views.xml @@ -47,12 +47,13 @@ - - + + + diff --git a/yuthon_official/views/official_menus.xml b/yuthon_official/views/official_menus.xml index 88e7f5b95..494d25a47 100644 --- a/yuthon_official/views/official_menus.xml +++ b/yuthon_official/views/official_menus.xml @@ -44,12 +44,12 @@ action="official_type_action" sequence="15"/> - + + + + + + - 收发文管理 + 行政收文 yuthon.official tree,form - - yuthon.official.tree - yuthon.official - - - - - - - - - - + + + + + + + + + + + + + - - yuthon.official.form - yuthon.official - -
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - send.receive.messages.management.search - yuthon.official - - - - - - - - - + + + + + + + + + + + + - - 我的行政收文 - yuthon.official - tree,form - - - - + + + + + + + + + + \ No newline at end of file