【发布时间】:2019-07-30 07:17:05
【问题描述】:
我在 sale.order.line 中有一个 many2one 字段。 它指向与 product.product 和 res.partner 有关系的自定义模型。
我希望这个新字段根据产品和客户(在 sale.order.line 中)返回自定义模型中的记录名称。
我在 sale.order.line.form.readonly XML 视图中添加了<field name="x_product_customer_reference" string="Product Customer Reference" context="{'default_x_customer_id': order_partner_id, 'default_x_product_id': product_id}"/>。
但新字段保持为空。为什么它不起作用? ...
【问题讨论】:
-
如果可能的话,请您在这里分享您的示例代码。
-
我在 Saas 上使用了 odoo 开发者模式。这是 sale.order.line 中的 XML 视图
<field name="x_product_customer_reference" string="Product Customer Reference" context="{'default_x_customer_id': order_partner_id, 'default_x_product_id': product_id}"/>我的自定义模型 x_customer_product_reference 有两个 many2one 字段,x_customer_id和x_product_id。 -
域也运行良好,但无法设置默认值