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

hi guys 
I m working on mrp.repair and mrp.repair.line


I would like to filter the list of product_id available on mrp.repair.line depending of the choice of the product id on mrp.repair.


So i tried to use an @api.onchange('repair_id.product_id') on the mrp.repair.line

but it doesn't work . 


I can do a compute on mrp.repair.line.product_id like this product_id = fields.Many2one('product.product', 'Product', required=True, domain=_compute_nomenc_product_ids) but it's not enough.
i really need to recompute when product_id on mrp.repair change. This 2 models are on the same view.
Does anybody have the solution? :)


Thanks a lot 

Thomas        

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Thanks Paresh for your answer.
Infact it s a just filter a list of product depending of the choice of a field attached to another model (product_id on mrp.repair) and others parameters (filter the list if the category is accessorie or square part, stock available .... )  . 


Depending of the choice , a different request need to be executed (if the product_id on mrp.repair has bom_ids , i need to list only bods_ids products.

That s why i need to use a method . 
So I can t use domain=[()] on xml if think isn t it?

Also if the product_id on the mrp.repair change i need to refresh the list


I hope it s more clear for you . Don t hesitate if you have more questions :)

Cheers




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

Hi Thomas:

It would help much if you provide a sample scenario and the expected outcome.

Cheers.

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

Hi Thomas:

Did you mean "recompute" or just "filter" the list of product ids that the user can select ?

If it is just to filter the list of products, you can use a domain="[(....)]" attribute of the field in the view definition.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 5 23
8175
1
thg 8 20
6436
0
thg 11 19
2683
0
thg 1 21
2494
4
thg 8 20
20565