添加功能

This commit is contained in:
李鹏宇
2025-12-10 10:09:57 +08:00
parent b92d964d80
commit eb8bffe7dd
7 changed files with 194 additions and 2 deletions
+1
View File
@@ -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',
@@ -1,6 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<record id="file_code_sequence" model="ir.sequence">
<field name="name">文件处理</field>
<field name="code">file_code</field>
<field name="prefix">WJC%(y)s%(month)s%(day)s</field>
<field name="padding">3</field>
<field name="company_id" eval="False"/>
</record>
<record id="official_code_sequence" model="ir.sequence">
<field name="name">公文编号</field>
<field name="code">official_code</field>
+1
View File
@@ -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
@@ -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,
# },
# }
+2 -1
View File
@@ -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
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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
7 access_yuthon_official_incoming_party yuthon_official_incoming_party model_yuthon_official_incoming_party base.group_user 1 1 1 1
8 access_yuthon_official_incoming_labor yuthon_official_incoming_labor model_yuthon_official_incoming_labor base.group_user 1 1 1 1
9 access_yuthon_official_incoming_normal yuthon_official_incoming_normal model_yuthon_official_incoming_normal base.group_user 1 1 1 1
10 access_yuthon_cross_departmental yuthon_cross_departmental model_yuthon_cross_departmental base.group_user 1 1 1 1
11 access_yuthon_file_processing yuthon_file_processing model_yuthon_file_processing base.group_user 1 1 1 1
+7 -1
View File
@@ -36,12 +36,18 @@
name="行政收文"
action="yuthon_official_incoming_normal_action"
sequence="10"/>
<menuitem
id="yuthon_file_processing_menu"
parent="yuthon_official_normal_management_menu"
name="文件处理"
action="yuthon_file_processing_action"
sequence="10"/>
<menuitem
id="yuthon_official_incoming_party"
parent="yuthon_official_party_management_menu"
name="党总支收文"
action="yuthon_official_incoming_party_action"
sequence="10"/>
sequence="15"/>
<menuitem
id="yuthon_official_party"
parent="yuthon_official_party_management_menu"
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="yuthon_file_processing_tree" model="ir.ui.view">
<field name="name">yuthon.file.processing.tree</field>
<field name="model">yuthon.file.processing</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="department_id"/>
<field name="time_date"/>
</tree>
</field>
</record>
<record id="yuthon_file_processing_form" model="ir.ui.view">
<field name="name">yuthon.file.processing.form</field>
<field name="model">yuthon.file.processing</field>
<field name="arch" type="xml">
<form>
<sheet>
<widget name="web_ribbon" title="普件" bg_color="text-bg-success"
invisible="urgency_level != 'normal'"/>
<widget name="web_ribbon" title="急件" bg_color="text-bg-warning"
invisible="urgency_level != 'urgent'"/>
<widget name="web_ribbon" title="特级" bg_color="text-bg-danger"
invisible="urgency_level != 'extra_urgent'"/>
<group col="4">
<group>
<field name="code" string="流水号" readonly="1"/>
</group>
<group>
<field name="urgency_level" readonly="1"/>
</group>
<group>
<field name="is_issues"/>
</group>
<group>
<field name="related_issues_id" invisible="not is_issues"/>
</group>
</group>
<div class="col-12 text-center">
<h1>
<field name="name_title" readonly="1"/>
</h1>
</div>
<group string="审批事项">
<field name="users_id"/>
<field name="company_id" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="work_end" invisible="1"/>
<field name="name" required="1"/>
<field name="main_text"/>
<field name="issues_result" invisible="is_issues == False"/>
<field name="official_documents_ids" widget="preview_many2many"/>
</group>
<group string="行政信息">
<group col="2">
<field name="official_partner_id"/>
<field name="secret_level"/>
<field name="time_date"/>
<field name="remarks"/>
</group>
<group>
<field name="is_supervising"/>
<field name="deadline" invisible="not is_supervising"/>
<field name="done_date" invisible="not is_supervising"/>
</group>
</group>
<notebook>
<page string="督办事项" invisible="not is_supervising">
<field name="workflow_inspector_ids"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="yuthon_file_processing_action" model="ir.actions.act_window">
<field name="name">文件处理</field>
<field name="res_model">yuthon.file.processing</field>
<field name="view_mode">tree,form</field>
</record>
</odoo>