55 lines
2.5 KiB
Python
55 lines
2.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
from odoo import api, fields, models, tools
|
|
from odoo.exceptions import UserError, ValidationError
|
|
|
|
|
|
class IssueLibrary(models.Model):
|
|
_name = "issue.library"
|
|
_description = '议题库'
|
|
_inherit = ['mail.thread.main.attachment', 'mail.activity.mixin']
|
|
_rec_name = 'name'
|
|
|
|
name = fields.Char(string='议题事项')
|
|
code = fields.Char(string='编号', required=True, copy=False,
|
|
default=lambda self: self.env['ir.sequence'].next_by_code('issue_library_code'))
|
|
statu = fields.Selection([('draft', '草稿'), ('approval', '审批中'), ('done', '已通过'), ('stop', '已拒绝'),
|
|
('will', '待上会'), ('on_meet', '已上会'), ('cancel', '已取消')], default='draft', string="议题状态")
|
|
is_party = fields.Boolean(string="党之委会")
|
|
is_party_pass = fields.Boolean(string="通过")
|
|
is_party_note = fields.Text(string="不通过意见")
|
|
is_class = fields.Boolean(string="班子会")
|
|
is_class_pass = fields.Boolean(string="通过")
|
|
is_class_note = fields.Text(string="不通过意见")
|
|
is_boss = fields.Boolean(string="董事会")
|
|
is_boss_pass = fields.Boolean(string="通过")
|
|
is_boss_note = fields.Text(string="不通过意见")
|
|
is_note = fields.Boolean(string="备案、核准")
|
|
creart_datetime = fields.Datetime(string="创建时间", default=fields.Datetime.now)
|
|
notice_documents_ids = fields.Many2many('documents.document', string="议题管理文件")
|
|
issue_type_id = fields.Many2one('issue.type', string="议题类型")
|
|
room_booking_id = fields.Many2one('room.booking', string="关联会议")
|
|
|
|
def issue_cancel(self):
|
|
self.write({"statu": "cancel"})
|
|
|
|
def all_meeting_issue(self):
|
|
for meet in self:
|
|
if meet.statu == 'done':
|
|
raise UserError('不可重复上会')
|
|
meet.write({"statu": "done"})
|
|
issue_active_ids = self.env["issue.library"].browse(self._context.get('active_ids', self._context.get('active_id')))
|
|
issue_library_data = [(0, 0, {'name': issue.name}) for issue in issue_active_ids]
|
|
form_id = self.env.ref("room.room_booking_view_form").id
|
|
return {
|
|
"type": "ir.actions.act_window",
|
|
"name": "会议安排",
|
|
"res_model": "room.booking",
|
|
"target": 'new',
|
|
"views": [[form_id, "form"]],
|
|
"context": {
|
|
'default_issue_room_booking_ids': issue_library_data,
|
|
}
|
|
}
|
|
|
|
|