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

Hello!


I'm a newbie with odoo. Can someone help me and tell how can i create dynamic selection fields in demo products? I need to add two selection fields: one for manufacturer (For example: LG, Samsung) and another selection field for the model that would depend from the selected manufacturer. For example, if we selected LG, then in models field we'll see only models for LG, and if Samsung is selected, then only models for samsung we can select in models field.


I've already read the official documentation, but still have no idea how to do it :\


Thanks for any help.

形象
丢弃
最佳答案

Hi,

Please check the the blog to know more about dynamic fields in Odoo.

 

形象
丢弃
最佳答案

Hey, 

you'll need to add two masters(new models), one will correspond to the manufacturer and the other to the manufacturer's model. In the manufacturer's model master, there will be a field corresponding to the manufacture. 

Now after adding the masters, you'll add two fields in the product view. One for "manufacturer" and another for "model". When the user selects the "manufacturer", trigger a method that will apply a domain for the "model" dropdown. It's called applying dynamic domain. 

This should work.

Thanks

形象
丢弃
编写者 最佳答案

Thank you for your answer, but I still have no idea how to make this fields  in products.

I think that blog for professionals...

What is the file wizard.py? Where should I create or edit it? or is it necessary to create a new model for this? Where should I place the get_possible_field_types method? In my new module in models.py? The same with onchange_field_type method...
I can't find any tutorials for beginners, there is only information for professionals.  For a example for django, I can find a huge amount of information and tutorial videos for beginners, and absolutely nothing for odoo.

形象
丢弃
相关帖文 回复 查看 活动
4
12月 23
22533
5
7月 24
15884
1
6月 22
27473
9
5月 22
53738
0
7月 20
3160