跳至内容
菜单
此问题已终结
1 回复
3318 查看

i had added two fields to the stock.picking model, 

sales_order_id = fields.Many2one('sale.order', 'Order')
client_ref = fields.Char(related='sales_order_id.client_order_ref')

i want to get the value of the client_order_ref from sale.order in an automatically manner, 

so that i tired this domai

 <record id="xxxxxxxx" model="ir.ui.view">
<field name="name">xxxxxxxxx</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="sales_order_id"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='user_id']" position="after">
    <field name="sales_order_id"/>
    <field name="client_ref" domain="[('sales_order_id', '=', 'origin')]"/>
but i still have to manually give a value to sales_order_id in order to get the client_ref

appropriate value 

形象
丢弃
最佳答案

1) Domain doesn't work for char fields
2) As the sale_id field already exists in stock.picking table
change your fields as below

client_ref = fields.Char(related='sale_id.client_order_ref')
sales_order_id = fields.Many2one('sale.order', 'Order') # No need to add this field
形象
丢弃
编写者

thanks, i didn't give attention to the sale_id field, you save my day

相关帖文 回复 查看 活动
2
12月 21
6145
6
8月 20
7414
1
12月 19
13367
3
7月 25
4168
0
5月 25
843