我在sale.order.line中有许多2ONE字段。它指出了与Product.fropoduct and Res.Partner相关的自定义模型。
我希望这个新字段基于产品和客户(in sale.order.line(中的自定义模型中的记录名称。
我在sale.order.line.form.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}"/>
。
,但是新领域空无一人。为什么不起作用?...
请写下以下代码
<field name="x_product_customer_reference" string="Product Customer Reference" context="{'default_x_customer_id': partner_id, 'default_x_product_id':product_id}"/>
请注意,伙伴_id字段应该在销售订单行中,因此请创建一个不可见的合作伙伴。
<field name="x_product_customer_reference" string="Product Customer Reference" context="{'default_x_customer_id': parent.partner_id, 'default_x_product_id':product_id}"/>