使用计算字段作为域
odoo13-addon-web-domain-field的Python项目详细描述
Web域字段
定义视图时,可以在关系字段上指定域 属性。此属性被计算为要在显示时应用的筛选器 现有记录供选择。在
<fieldname="product_id"domain="[('type','=','product')]"/>
为域属性提供的值必须是表示 有效的Odoo域。此字符串在客户端的 在受限上下文中,我们可以将 表单中的字段和一组有限的函数。在
在这种情况下,很难建立复杂的领域,我们面临一些 限制如下:
- The syntax to include in your domain a criteria involving values from a x2many field is complex.
- The right side of domain in case of x2many can involve huge amount of ids (performance problem).
- Domains computed by an onchange on an other field are not recomputed when you modify the form and don’t modify the field triggering the onchange.
- It’s not possible to extend an existing domain. You must completely redefine the domain in your specialized addon
- etc…
为了减轻这些限制,这个新的插件允许您使用 在 查看。在
^{pr2}$用作域的字段必须以JSON编码的字符串形式提供域。在
product_id_domain=fields.Char(compute="_compute_product_id_domain",readonly=True,store=False,)@api.multi@api.depends('name')def_compute_product_id_domain(self):forrecinself:rec.product_id_domain=json.dumps([('type','=','product'),('name','like',rec.name)])
Bug跟踪器
bug在GitHub Issues上跟踪。万一有麻烦,请 检查是否已经报告了您的问题。如果你先发现的话, 通过提供详细而受欢迎的反馈,帮助我们粉碎它。在
学分
图像
- 奥多社区协会:Icon。在
贡献者
- 劳伦特·米格农<;laurent.mignon@acsone.eu>
- 丹尼斯·罗塞尔<;denis.roussel@acsone.eu>
维修人员
本模块由OCA维护。在
OCA,或奥多社区协会,是一个非营利性组织 其任务是支持Odoo特性和 促进其广泛使用。在
要对本模块有所贡献,请访问https://odoo-community.org。在
- 项目
标签: