143 lines
7.2 KiB
Python
143 lines
7.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
from odoo import models, fields, api
|
|
|
|
|
|
class TxSelectionProducts(models.Model):
|
|
_name = 'tx.selection.products'
|
|
_inherit = ['mail.thread', 'mail.activity.mixin']
|
|
_description = '甄选产品'
|
|
_order = "recommend DESC, id DESC"
|
|
|
|
def _domain_good_ids(self):
|
|
parent_id = self.env["tx.data.dict"].search([("code", "=", "ys_products_industry_type")], limit=1)
|
|
return [("parent_id", "=", parent_id.id),
|
|
("category", "=", "value")]
|
|
|
|
def _domain_characteristic_ids(self):
|
|
parent_id = self.env["tx.data.dict"].search([("code", "=", "ys_products_type")], limit=1)
|
|
return [("parent_id", "=", parent_id.id),
|
|
("category", "=", "value")]
|
|
|
|
def _domain_technical_ids(self):
|
|
parent_id = self.env["tx.data.dict"].search([("code", "=", "ys_technical_type")], limit=1)
|
|
return [("parent_id", "=", parent_id.id),
|
|
("category", "=", "value")]
|
|
|
|
def _domain_industry_ids(self):
|
|
parent_id = self.env["tx.data.dict"].search([("code", "=", "ys_industry_type")], limit=1)
|
|
return [("parent_id", "=", parent_id.id),
|
|
("category", "=", "value")]
|
|
|
|
img = fields.Image(string="图片", tracking=True)
|
|
name = fields.Char(string='名称', tracking=True)
|
|
company_name = fields.Char(string="公司名称", tracking=True)
|
|
brief_introduction = fields.Html(string="产品简介", tracking=True)
|
|
content = fields.Html(string="产品内容", tracking=True)
|
|
|
|
good_ids = fields.Many2many("tx.data.dict", "tx_products_good_ref", "product_id", "good_id", tracking=True,
|
|
string="产品应用行业", domain=lambda self: self._domain_good_ids())
|
|
characteristic_ids = fields.Many2many("tx.data.dict", "tx_products_characteristic_ref", "product_id", "characteristic_id", tracking=True,
|
|
string="特色产品", domain=lambda self: self._domain_characteristic_ids())
|
|
technical_ids = fields.Many2many("tx.data.dict", "tx_products_technical_ref", "product_id", "technical_id", tracking=True,
|
|
string="技术领域", domain=lambda self: self._domain_technical_ids())
|
|
industry_ids = fields.Many2many("tx.data.dict", "tx_products_industry_ref", "product_id", "industry_id", tracking=True,
|
|
string="行业领域", domain=lambda self: self._domain_industry_ids())
|
|
recommend = fields.Boolean(string="是否推荐", default=False)
|
|
|
|
line_ids = fields.One2many("supply.demand.line", "product_id", string="详情")
|
|
|
|
|
|
class TxFineService(models.Model):
|
|
_name = 'tx.fine.service'
|
|
_inherit = ['mail.thread', 'mail.activity.mixin']
|
|
_description = '精细服务'
|
|
_order = "recommend DESC, id DESC"
|
|
|
|
def _domain_good_ids(self):
|
|
parent_id = self.env["tx.data.dict"].search([("code", "=", "ys_products_industry_type")], limit=1)
|
|
return [("parent_id", "=", parent_id.id),
|
|
("category", "=", "value")]
|
|
|
|
def _domain_characteristic_ids(self):
|
|
parent_id = self.env["tx.data.dict"].search([("code", "=", "ys_products_type")], limit=1)
|
|
return [("parent_id", "=", parent_id.id),
|
|
("category", "=", "value")]
|
|
|
|
def _domain_technical_ids(self):
|
|
parent_id = self.env["tx.data.dict"].search([("code", "=", "ys_technical_type")], limit=1)
|
|
return [("parent_id", "=", parent_id.id),
|
|
("category", "=", "value")]
|
|
|
|
def _domain_industry_ids(self):
|
|
parent_id = self.env["tx.data.dict"].search([("code", "=", "ys_industry_type")], limit=1)
|
|
return [("parent_id", "=", parent_id.id),
|
|
("category", "=", "value")]
|
|
|
|
img = fields.Image(string="图片", tracking=True)
|
|
name = fields.Char(string='名称', tracking=True)
|
|
company_name = fields.Char(string="公司名称", tracking=True)
|
|
brief_introduction = fields.Html(string="精细服务简介", tracking=True)
|
|
content = fields.Html(string="精细服务内容", tracking=True)
|
|
|
|
good_ids = fields.Many2many("tx.data.dict", "tx_service_good_ref", "service_id", "good_id", tracking=True,
|
|
string="产品应用行业", domain=lambda self: self._domain_good_ids())
|
|
characteristic_ids = fields.Many2many("tx.data.dict", "tx_service_characteristic_ref", "service_id", "characteristic_id", tracking=True,
|
|
string="特色产品", domain=lambda self: self._domain_characteristic_ids())
|
|
technical_ids = fields.Many2many("tx.data.dict", "tx_service_technical_ref", "service_id", "technical_id", tracking=True,
|
|
string="技术领域", domain=lambda self: self._domain_technical_ids())
|
|
industry_ids = fields.Many2many("tx.data.dict", "tx_service_industry_ref", "service_id", "industry_id", tracking=True,
|
|
string="行业领域", domain=lambda self: self._domain_industry_ids())
|
|
recommend = fields.Boolean(string="是否推荐", default=False)
|
|
remarks = fields.Text(string="备注")
|
|
|
|
line_ids = fields.One2many("supply.demand.line", "service_id", string="详情")
|
|
|
|
|
|
|
|
class TxHighQualitySolutions(models.Model):
|
|
_name = 'tx.high.quality.solutions'
|
|
_inherit = ['mail.thread', 'mail.activity.mixin']
|
|
_description = '优质方案'
|
|
_order = "recommend DESC, id DESC"
|
|
|
|
def _domain_technical_ids(self):
|
|
parent_id = self.env["tx.data.dict"].search([("code", "=", "ys_technical_type")], limit=1)
|
|
return [("parent_id", "=", parent_id.id),
|
|
("category", "=", "value")]
|
|
|
|
def _domain_industry_ids(self):
|
|
parent_id = self.env["tx.data.dict"].search([("code", "=", "ys_industry_type")], limit=1)
|
|
return [("parent_id", "=", parent_id.id),
|
|
("category", "=", "value")]
|
|
|
|
img = fields.Image(string="图片", tracking=True)
|
|
name = fields.Char(string='名称', tracking=True)
|
|
company_name = fields.Char(string="公司名称", tracking=True)
|
|
brief_introduction = fields.Html(string="简介", tracking=True)
|
|
content = fields.Html(string="内容", tracking=True)
|
|
|
|
technical_ids = fields.Many2many("tx.data.dict", "tx_solutions_technical_ref", "solutions_id", "technical_id", tracking=True,
|
|
string="技术领域", domain=lambda self: self._domain_technical_ids())
|
|
industry_ids = fields.Many2many("tx.data.dict", "tx_solutions_industry_ref", "solutions_id", "industry_id", tracking=True,
|
|
string="行业领域", domain=lambda self: self._domain_industry_ids())
|
|
recommend = fields.Boolean(string="是否推荐", default=False, tracking=True)
|
|
remarks = fields.Text(string="备注", tracking=True)
|
|
|
|
line_ids = fields.One2many("supply.demand.line", "solutions_id", string="详情")
|
|
|
|
|
|
class SupplyDemandLine(models.Model):
|
|
_name = "supply.demand.line"
|
|
_description = "详细信息"
|
|
_order = 'sequence'
|
|
|
|
sequence = fields.Integer()
|
|
product_id = fields.Many2one("tx.selection.products", string="甄选产品")
|
|
service_id = fields.Many2one("tx.fine.service", string="精细服务")
|
|
solutions_id = fields.Many2one("tx.high.quality.solutions", string="优质方案")
|
|
|
|
name = fields.Char("简介")
|
|
content = fields.Html("内容")
|
|
|