42 lines
1.5 KiB
Python
42 lines
1.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
from odoo import models, fields, api
|
|
|
|
|
|
class TxDemand(models.Model):
|
|
_name = 'tx.demand'
|
|
_inherit = ['mail.thread', 'mail.activity.mixin']
|
|
_description = '需求'
|
|
|
|
def _domain_tag_ids(self):
|
|
parent_id = self.env["tx.data.dict"].search([("code", "=", "pub_tags")], limit=1)
|
|
return [("parent_id", "=", parent_id.id),
|
|
("category", "=", "value")]
|
|
|
|
name = fields.Char(string='标题', tracking=True)
|
|
company_name = fields.Char(string='公司名称', tracking=True)
|
|
tag_ids = fields.Many2many("tx.data.dict", string="标签", domain=lambda self: self._domain_tag_ids(), tracking=True)
|
|
describe = fields.Html(string="描述", tracking=True)
|
|
cycle = fields.Integer(string="项目周期", tracking=True)
|
|
budget = fields.Float(string="项目预算", tracking=True)
|
|
urgent_state = fields.Selection([
|
|
("not urgent", "不紧急"),
|
|
("urgent", "紧急")], string="紧急程度", default="not urgent", tracking=True)
|
|
state = fields.Selection([
|
|
("draft", "草稿"),
|
|
("approve", "待审核"),
|
|
("pass", "通过"),
|
|
("reject", "驳回")], string="状态", default="draft", tracking=True)
|
|
|
|
def action_draft(self):
|
|
self.write({"state": "draft"})
|
|
|
|
def action_approve(self):
|
|
self.write({"state": "approve"})
|
|
|
|
def action_pass(self):
|
|
self.write({"state": "pass"})
|
|
|
|
def action_reject(self):
|
|
self.write({"state": "reject"})
|