Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
1033 Lượt xem

We have model called lading.bill and in the many2one field called x_studio_delivery_address and many2many field x_studio_transfers.

Once I select the delivery address on the many2one field, I want to only show the transfers  (stock.picking) model that includes the partner name (delivery address) on the many2one field.

Have tested multiple different approaches, but no luck. Domain is either returning completely empty or all the records.

[('partner_id', '=', x_studio_delivery_address)]

Appreciate for good solution !

Ảnh đại diện
Huỷ bỏ
Tác giả

Still returns all the records, 

I'm using studio in V15 enterprise. So would love to find detailed answer using studio only.

Câu trả lời hay nhất

Try this: 

@api.onchange('x_studio_delivery_address')
def x_studio_delivery_address(self):
return {'domain': {'x_studio_transfers': [('partner_id', 'in', self.x_studio_delivery_address.partner_id.id)]}}



Ảnh đại diện
Huỷ bỏ