如何解决Odoo 14:Function.prototype.apply 的 One2many 字段中的域过滤器的第二个参数必须是数组
我在 Odoo 12 中有此代码并且在我们迁移到 Odoo 14 后运行良好,在单击角色字段时出现错误。
代码错误
Traceback:
Error: second argument to Function.prototype.apply must be an array
第一次观看 view
堆栈跟踪 error message
字段角色的填充方式如下:
查看:
<odoo>
<data>
<record id="product_pricelist_item_form_inherit" model="ir.ui.view">
<field name="name">product.pricelist.item.inherit</field>
<field name="model">product.pricelist.item</field>
<field name="inherit_id" ref="product.product_pricelist_item_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_tmpl_id']" position="attributes">
<attribute name="string">Roles</attribute>
<attribute name="domain">"[('is_employee','=',True)]"</attribute>
</record>
</data>
</odoo>
模型中的变量:
item_ids = fields.One2many('product.pricelist.item','pricelist_id','Pricelist Items',copy=True,default=False)
is_employee = fields.Boolean(string='Is an Employee',default=True)
Odoo 14 是否有语法更新?
解决方法
当我们在xml端使用属性应用域时,它应该是列表样式而不是双引号。例如
<attribute name="domain">[('is_employee','=',True)]</attribute>
不要忘记关闭 xpath 标签。我看不到你的问题。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。