From eb8bffe7dd6f0a4e2abbac5a025e6be32e7645b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Wed, 10 Dec 2025 10:09:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_official/__manifest__.py | 1 + yuthon_official/data/official_type_data.xml | 7 ++ yuthon_official/models/__init__.py | 1 + .../models/yuthon_file_processing.py | 93 +++++++++++++++++++ yuthon_official/security/ir.model.access.csv | 3 +- yuthon_official/views/official_menus.xml | 8 +- .../views/yuthon_file_processing_views.xml | 83 +++++++++++++++++ 7 files changed, 194 insertions(+), 2 deletions(-) create mode 100644 yuthon_official/models/yuthon_file_processing.py create mode 100644 yuthon_official/views/yuthon_file_processing_views.xml diff --git a/yuthon_official/__manifest__.py b/yuthon_official/__manifest__.py index 2b590526f..9710074b8 100644 --- a/yuthon_official/__manifest__.py +++ b/yuthon_official/__manifest__.py @@ -22,6 +22,7 @@ 'views/yuthon_official_labor_views.xml', 'views/yuthon_official_incoming_labor_views.xml', 'views/yuthon_official_party_views.xml', + 'views/yuthon_file_processing_views.xml', 'views/yuthon_official_incoming_party_views.xml', 'views/yuthon_cross_departmental_views.xml', # 'views/inherit_soong_workflow_insector_views.xml', diff --git a/yuthon_official/data/official_type_data.xml b/yuthon_official/data/official_type_data.xml index 523213c5d..0a84f4469 100644 --- a/yuthon_official/data/official_type_data.xml +++ b/yuthon_official/data/official_type_data.xml @@ -1,6 +1,13 @@ + + 文件处理 + file_code + WJC%(y)s%(month)s%(day)s + 3 + + 公文编号 official_code diff --git a/yuthon_official/models/__init__.py b/yuthon_official/models/__init__.py index 9edd7b219..bb777bc64 100644 --- a/yuthon_official/models/__init__.py +++ b/yuthon_official/models/__init__.py @@ -12,3 +12,4 @@ from . import inherit_soong_workflow_insector from . import inherit_room_booking from . import inherit_issue_library from . import yuthon_cross_departmental +from . import yuthon_file_processing diff --git a/yuthon_official/models/yuthon_file_processing.py b/yuthon_official/models/yuthon_file_processing.py new file mode 100644 index 000000000..123b47602 --- /dev/null +++ b/yuthon_official/models/yuthon_file_processing.py @@ -0,0 +1,93 @@ +# -*- coding: utf-8 -*- +from odoo import api, fields, models, tools +from odoo.exceptions import ValidationError, UserError + + +class YuthonFileProcessing(models.Model): + _name = 'yuthon.file.processing' + _description = '文件处理' + _inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin'] + _rec_name = 'name' + + name = fields.Char(string="标题") + code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('file_code')) + official_type_id = fields.Many2one('official.type', string="公文种类") + reference_date = fields.Date(string='来问日期') + major_event_category = fields.Integer(string="重大事项所属类别") + official_partner_id = fields.Many2one('official.partner', string="来文单位") + remarks = fields.Char(string="备注事项") + main_text = fields.Text(string='正文') + come_file_id = fields.Char(string="来文编号") + incoming_file_id = fields.Char(string="收文编号") + urgency_level = fields.Selection([('normal', '一般'), ('urgent', '紧急'), ('extra_urgent', '特急')], string="紧急程度", default='normal') + secret_level = fields.Selection([('normal', '一般'), ('urgent', '秘密'), ('secret', '机密'), ('so_secret', '绝密')], string="密级") + time_date = fields.Datetime(string="日期", default=fields.Datetime.now) + 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="拟办部门") + company_id = fields.Many2one(related='users_id.employee_id.company_id', string="公司") + department_data = fields.Html(string="拟办意见") + red_suit = fields.Char(string="套红") + official_statu = fields.Selection([('done', '办结'), ('approval', '审核')], string="公文环节") + active = fields.Boolean('Active', default=True, tracking=True) + work_end = fields.Boolean(string="结束") + + is_issues = fields.Boolean(string="是否上会") + issues_result = fields.Html(string="会议结果") + is_supervising = fields.Boolean(string="是否督办") + deadline = fields.Datetime(string="办理期限") + done_date = fields.Date(string="完成时间") + is_official_incoming = fields.Boolean(string="是否收文") + official_documents_ids = fields.Many2many('ir.attachment', string="收文附件") + + workflow_inspector_ids = fields.One2many('soong.workflow.inspector', 'incoming_normal_id', string="督办事项") + room_booking_ids = fields.One2many('room.booking', 'incoming_normal_id', string="会议关联") + issue_library_ids = fields.One2many('issue.library', 'incoming_normal_id', string="议题关联") + related_issues_id = fields.Many2one('issue.library', string="关联议题") + def _get_default_name_title(self): + return self._description if self._description else self._name + + name_title = fields.Char(default=_get_default_name_title) + self_users_ids = fields.Many2many('res.users', string="当前经办人", default=lambda self: [(6, 0, [self.env.user.id])]) + + @api.onchange('is_issues') + def _onchange_is_issues(self): + if self.is_issues: + issue_id = self.env['issue.library'].create({'name': self.name, 'is_invisible_workflow': True}) + self.related_issues_id = issue_id.id + self.env['issue.library.approval.line'].create({ + 'issue_library_id': issue_id.id, + 'workflow_name': self.name, + 'approval_type': self.workflow_id.name, + 'res_model': self._name, + 'res_id': self.id, + 'code': self.code, + 'approval_date': fields.Datetime.now(), + }) + + def supervising_button(self): + return { + "name": "督查督办", + "type": "ir.actions.act_window", + "view_mode": "form", + "res_model": "soong.workflow.inspector", + "views": [[self.env.ref('soong_workflow.soong_workflow_inspector_form').id, "form"]], + "context": {'default_name': self.name, + 'default_start_data': fields.Date.today(), + 'default_end_data': self.done_date, + 'default_relevancy_type': 'yuthon_official_incoming_normal', + 'default_incoming_normal_id': self.id, + }, + } + # def button_meet(self): + # return { + # "name": "会议", + # "type": "ir.actions.act_window", + # "view_mode": "form", + # "res_model": "room.booking", + # "views": [[self.env.ref('room.room_booking_view_form').id, "form"]], + # "context": { + # 'default_name': self.name, + # 'default_relevancy_type': 'yuthon_official_incoming_normal', + # 'default_incoming_normal_id': self.id, + # }, + # } diff --git a/yuthon_official/security/ir.model.access.csv b/yuthon_official/security/ir.model.access.csv index 57f486a76..a03c2f03e 100644 --- a/yuthon_official/security/ir.model.access.csv +++ b/yuthon_official/security/ir.model.access.csv @@ -7,4 +7,5 @@ access_yuthon_official_party,yuthon_official_party,model_yuthon_official_party,b access_yuthon_official_incoming_party,yuthon_official_incoming_party,model_yuthon_official_incoming_party,base.group_user,1,1,1,1 access_yuthon_official_incoming_labor,yuthon_official_incoming_labor,model_yuthon_official_incoming_labor,base.group_user,1,1,1,1 access_yuthon_official_incoming_normal,yuthon_official_incoming_normal,model_yuthon_official_incoming_normal,base.group_user,1,1,1,1 -access_yuthon_cross_departmental, yuthon_cross_departmental,model_yuthon_cross_departmental,base.group_user,1,1,1,1 \ No newline at end of file +access_yuthon_cross_departmental, yuthon_cross_departmental,model_yuthon_cross_departmental,base.group_user,1,1,1,1 +access_yuthon_file_processing,yuthon_file_processing,model_yuthon_file_processing,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/yuthon_official/views/official_menus.xml b/yuthon_official/views/official_menus.xml index 501c77eee..18bc4023d 100644 --- a/yuthon_official/views/official_menus.xml +++ b/yuthon_official/views/official_menus.xml @@ -36,12 +36,18 @@ name="行政收文" action="yuthon_official_incoming_normal_action" sequence="10"/> + + sequence="15"/> + + + yuthon.file.processing.tree + yuthon.file.processing + + + + + + + + + + yuthon.file.processing.form + yuthon.file.processing + +
+ + + + + + + + + + + + + + + + + + +
+

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + 文件处理 + yuthon.file.processing + tree,form + + +
\ No newline at end of file