From 4fb0ab5e023f5cb6c38075d629eb10d86122c430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Sat, 16 Nov 2024 19:42:51 +0800 Subject: [PATCH] pengyuthon wechat --- soong_workflow/models/soong_workflow.py | 2 +- soong_workflow/models/soong_workflow_mixin.py | 8 ++++---- soong_workflow/models/soong_workflow_node.py | 5 ++++- .../views/soong_workflow_node_views.xml | 11 ++--------- .../wizard/soong_workflow_comment_wizard.py | 16 ++++++++++++---- .../models/yuthon_official_incoming_normal.py | 3 ++- .../yuthon_official_incoming_normal_views.xml | 3 ++- yuthon_tianhe/__manifest__.py | 2 +- yuthon_tianhe/i18n/zh_CN.po | 8 -------- 9 files changed, 28 insertions(+), 30 deletions(-) diff --git a/soong_workflow/models/soong_workflow.py b/soong_workflow/models/soong_workflow.py index 073ebb319..0833a28dd 100644 --- a/soong_workflow/models/soong_workflow.py +++ b/soong_workflow/models/soong_workflow.py @@ -47,7 +47,7 @@ class SoongWorkflow(models.Model): current_stage_highlight_color = fields.Char(string="当前阶段颜色", 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, default=fields.Date.from_string('2099-01-01')) - is_enable = fields.Boolean(string="是否启用", default="False", compute="compute_is_enable", store=True) + is_enable = fields.Boolean(string="是否启用", compute="compute_is_enable", store=True) is_enable_return_button = fields.Boolean(string="是否启用收回", default=True) is_enable_transmitted_button = fields.Boolean(string="是否启用转交", default=True) approvals_group_id = fields.Many2one('soong.approval.group', string="审批分组") diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py index 426d27bf3..2db6db979 100644 --- a/soong_workflow/models/soong_workflow_mixin.py +++ b/soong_workflow/models/soong_workflow_mixin.py @@ -21,7 +21,7 @@ class SoongWorkflowMixin(models.AbstractModel): wkf_obj = self.env["soong.workflow"] rec_model = self._name # Get Flow Start - wkf_recs = wkf_obj.search([("model_id", "=", rec_model), ('is_enable', '=', 'yes')]) + wkf_recs = wkf_obj.search([("model_id", "=", rec_model), ('is_enable', '=', True)]) for wkf_rec in wkf_recs: for node in wkf_rec.node_ids: if node.flow_start: @@ -35,7 +35,7 @@ class SoongWorkflowMixin(models.AbstractModel): rec_model = self._name ret = [] # Get Status - wkf_recs = wkf_obj.search([("model_id", "=", rec_model), ('is_enable', '=', 'yes')]) + wkf_recs = wkf_obj.search([("model_id", "=", rec_model), ('is_enable', '=', True)]) for rec in wkf_recs: for node in rec.node_ids: ret.append((node.node_name, node.name)) @@ -76,7 +76,7 @@ class SoongWorkflowMixin(models.AbstractModel): # Variables rec_model = rec._name # Get Workflow - rec.workflow_id = wkf_obj.search([("model_id", "=", rec_model), ('is_enable', '=', 'yes')]) + rec.workflow_id = wkf_obj.search([("model_id", "=", rec_model), ('is_enable', '=', True)]) node_id = fields.Many2one( comodel_name="soong.workflow.node", @@ -93,7 +93,7 @@ class SoongWorkflowMixin(models.AbstractModel): rec_model = rec._name # Get Workflow Node rec.node_id = wkf_obj.search( - [("model_id", "=", rec_model), ('is_enable', '=', 'yes')] + [("model_id", "=", rec_model), ('is_enable', '=', True)] ).node_ids.filtered(lambda n: n.node_name == rec.state) if rec.node_id.flow_start: rec.approve_state = "start" diff --git a/soong_workflow/models/soong_workflow_node.py b/soong_workflow/models/soong_workflow_node.py index 7faeb0c8b..c80cb5f7a 100644 --- a/soong_workflow/models/soong_workflow_node.py +++ b/soong_workflow/models/soong_workflow_node.py @@ -83,6 +83,9 @@ class SoongWorkflowNode(models.Model): res_bg_color = fields.Char(compute="_compute_custom_colors", readonly=True, string="Backgroung Color") res_label_color = fields.Char(compute="_compute_custom_colors", readonly=True, string="Label Color") + is_carbon_copy = fields.Boolean(string="是否抄送") + employee_ids = fields.Many2many('hr.employee', string='抄送人员') + @api.model_create_multi def create(self, values): for val in values: @@ -309,7 +312,7 @@ class SoongWorkflowNodeButton(models.Model): rec.workflow_id = ( self.env["soong.workflow"] .sudo() - .search([("model_id", "=", model_id), ('is_enable', '=', 'yes')]) + .search([("model_id", "=", model_id), ('is_enable', '=', True)]) ) @api.constrains("btn_key") diff --git a/soong_workflow/views/soong_workflow_node_views.xml b/soong_workflow/views/soong_workflow_node_views.xml index b4307a41a..588561380 100644 --- a/soong_workflow/views/soong_workflow_node_views.xml +++ b/soong_workflow/views/soong_workflow_node_views.xml @@ -1,8 +1,5 @@ - soong.workflow.node.form soong.workflow.node @@ -37,6 +34,8 @@ + + @@ -82,9 +81,6 @@ - soong.workflow.node.field.form soong.workflow.node.field @@ -128,9 +124,6 @@ - soong.workflow.node.button.form soong.workflow.node.button diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py index 2dc446b74..8455b71f6 100644 --- a/soong_workflow/wizard/soong_workflow_comment_wizard.py +++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py @@ -69,7 +69,7 @@ class SoongWorkflowCommentWizard(models.TransientModel): record_id = self.env[self.res_model].search([('id', '=', self.res_id)]) for ret in self.return_link_id: if ret.name == '拟办': - self.employee_ids = record_id.user_id.employee_id + self.employee_ids = record_id.users_id.employee_id elif self.node_btn_name == '退回': workflow_id = self.return_link_id.node_button_id.workflow_id state_list = ['拟办' if i.node_name == 'start' else i.node_name for i in workflow_id.node_ids] @@ -88,6 +88,17 @@ class SoongWorkflowCommentWizard(models.TransientModel): self.ensure_one() cx = self.env.context.copy() or {} record_id = self.env[self.res_model].search([('id', '=', self.res_id)]) + # 抄送人员 + if self.node_btn_name == '转交': + self_node_id = record_id.workflow_id.node_ids.search([('name', '=', record_id.state), ('workflow_id', '=', record_id.workflow_id.id)]) + if self_node_id.is_carbon_copy: + for employee in self_node_id.employee_ids: + if not employee.wecom_userid: + raise ("请同步{}的企业微信".format(employee.name)) + url = "https://oa.thtzjt.com/mail/view?model={}&res_id={}".format(self.res_model, record_id.id) + self.sudo().env["wecom.apps"].sync_send_message_textcard(category='oa', user_id=employee.wecom_userid, + title="审批抄送提醒", description="您有新的抄送提醒请及时查看", + url=url, btntxt="详细信息") # 转交逻辑--单线 if not self.node_link_len and self.node_btn_name == '转交': state = self.node_btn_id.node_id.out_link_ids.name.split('-> ')[-1] @@ -104,7 +115,4 @@ class SoongWorkflowCommentWizard(models.TransientModel): if self.node_btn_name == '加签': record_id.approval_sign_ids = self.approval_users_ids - # self.sudo().env["wecom.apps"].sync_send_message_textcard(category='default', user_id="18562027762", - # title="测试", description="测试", - # url="https://oa.thtzjt.com", btntxt="详情") return self.node_btn_id.with_context(cx).run() diff --git a/yuthon_official/models/yuthon_official_incoming_normal.py b/yuthon_official/models/yuthon_official_incoming_normal.py index 08bb78dc1..1edde5d70 100644 --- a/yuthon_official/models/yuthon_official_incoming_normal.py +++ b/yuthon_official/models/yuthon_official_incoming_normal.py @@ -27,7 +27,8 @@ class YuthonOfficialIncomingNormal(models.Model): urgency = fields.Selection([('normal', '一般'), ('urgent', '紧急'), ('extra_urgent', '特急')], string="紧急程度") secret_level = fields.Selection([('normal', '一般'), ('urgent', '秘密'), ('secret', '机密'), ('so_secret', '绝密')], string="密级") time_date = fields.Datetime(string="日期", default=fields.Datetime.now) - department_id = fields.Many2one('hr.department', string="拟办部门") + users_id = fields.Many2one('res.users', string="拟办人", default=lambda self: self.env.user.id) + department_id = fields.Many2one(related='users_id.employee_id.department_id', string="拟办部门") department_data = fields.Html(string="拟办意见") red_suit = fields.Char(string="套红") official_statu = fields.Selection([('done', '办结'), ('approval', '审核')], string="公文环节") diff --git a/yuthon_official/views/yuthon_official_incoming_normal_views.xml b/yuthon_official/views/yuthon_official_incoming_normal_views.xml index 510ee097e..884701d53 100644 --- a/yuthon_official/views/yuthon_official_incoming_normal_views.xml +++ b/yuthon_official/views/yuthon_official_incoming_normal_views.xml @@ -31,6 +31,7 @@ + @@ -43,7 +44,7 @@ - + diff --git a/yuthon_tianhe/__manifest__.py b/yuthon_tianhe/__manifest__.py index 52b3f84c7..42d867e99 100644 --- a/yuthon_tianhe/__manifest__.py +++ b/yuthon_tianhe/__manifest__.py @@ -13,7 +13,7 @@ 'version': '0.1', 'license': 'LGPL-3', - 'depends': ['base', 'base_setup', 'web', 'website_slides', 'website'], + 'depends': ['base', 'base_setup', 'web', 'website'], 'assets': { 'web.assets_frontend': [ diff --git a/yuthon_tianhe/i18n/zh_CN.po b/yuthon_tianhe/i18n/zh_CN.po index 9fca082a4..c63c2179b 100644 --- a/yuthon_tianhe/i18n/zh_CN.po +++ b/yuthon_tianhe/i18n/zh_CN.po @@ -74,14 +74,6 @@ msgstr "办公用品管理" msgid "Fleet" msgstr "车辆管理" -#. module: website_slides -#. odoo-javascript -#. odoo-python -#: model:ir.ui.menu,name:website_slides.website_slides_menu_root -#, python-format -msgid "eLearning" -msgstr "培训学习" - #. module: website #. odoo-javascript #. odoo-python