Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
5539 มุมมอง

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.

Related Posts ตอบกลับ มุมมอง กิจกรรม
GDPR checkbox for landing page แก้ไขแล้ว
2
ธ.ค. 23
1302
1
ก.ค. 23
2376
0
พ.ค. 23
2210
3
มี.ค. 25
23549
I can't upload any file in Odoo 13 แก้ไขแล้ว
1
พ.ย. 22
2042