コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
5621 ビュー

Odoo 13

 

I am looking to change what is selected by default in a many2many checkbox widget but I am unsure of where this is done.

 

In my case the second option is checked by default but I would like the third and fourth option to be checked by default instead. In Odoo it is inside an inventory tab in the product template form in the inventory module but I am unsure where it is set in the code.

アバター
破棄
最善の回答

It can be done using Automated Actions.  For example, to default Routes on stockable products:

  • Model = Product Template
  • Action To Do = Execute Python Code
  • Trigger Condition = On Creation
  • Apply On:
    • Use domain to select which products are updated. In this example, we are only only updating stockable / storable products, though you might want to include consumables as well.

Python Code

In this example, we are selecting Buy (5) and Make to Order (1). Multiple routes are selected by entering the Records IDs separated by commas.

record['route_ids'] = [5,1]

アバター
破棄
著作者

This did the trick! Thanks for the answer and the link, I think that site will come in handy in the future.

関連投稿 返信 ビュー 活動
1
7月 25
2443
2
12月 23
1340
0
5月 23
2236
3
3月 25
23677
1
11月 22
2091