85 lines
4.2 KiB
Python
85 lines
4.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
from odoo import api, fields, models, tools
|
|
from odoo.exceptions import ValidationError, UserError
|
|
|
|
|
|
class YuthonOfficialIncomingNormal(models.Model):
|
|
_name = 'yuthon.official.incoming.normal'
|
|
_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('official_code'))
|
|
official_type_id = fields.Many2one('official.type', string="公文种类")
|
|
reference_cold = fields.Integer(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.Html(string='正文')
|
|
come_file_id = fields.Char(string="来文编号")
|
|
incoming_file_id = fields.Char(string="收文编号")
|
|
main_flats = fields.Char(string="主送")
|
|
copy_flats = fields.Char(string="抄送")
|
|
servings_number = fields.Integer(string="份数")
|
|
urgency = fields.Selection([('normal', '一般'), ('urgent', '紧急'), ('extra_urgent', '特急')], string="紧急程度")
|
|
secret_level = fields.Selection([('normal', '一般'), ('urgent', '秘密'), ('secret', '机密'), ('so_secret', '绝密')], string="密级")
|
|
date = fields.Datetime(string="日期", default=fields.Datetime.now)
|
|
department_id = fields.Many2one('hr.department', string="拟办部门")
|
|
department_data = fields.Html(string="拟办意见")
|
|
red_suit = fields.Char(string="套红")
|
|
official_statu = fields.Selection([('done', '办结'), ('approval', '审核')], string="公文环节")
|
|
|
|
is_meet = fields.Boolean(string="是否上会")
|
|
is_supervising = fields.Boolean(string="是否督办")
|
|
deadline = fields.Date(string="办理期限")
|
|
done_date = fields.Date(string="完成时间")
|
|
is_official_incoming = fields.Boolean(string="是否收文")
|
|
official_documents_ids = fields.Many2many('documents.document', 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="议题关联")
|
|
|
|
def issue_button(self):
|
|
return {
|
|
"name": "议题库",
|
|
"type": "ir.actions.act_window",
|
|
"view_mode": "form",
|
|
"res_model": "issue.library",
|
|
"views": [[self.env.ref('yuthon_issue.view_issue_library_form').id, "form"]],
|
|
"context": {'default_name': self.name,
|
|
'default_relevancy_type': 'yuthon_official_incoming_normal',
|
|
'default_incoming_normal_id': self.id,
|
|
},
|
|
}
|
|
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,
|
|
},
|
|
}
|