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

Greetings all,

How can I allow the user to select a single/multiple item(s) from a One2Many list?

Then how can I trigger some method in the model passing the ID(s) of the selected item(s)?

The problem when using your suggested approach is that currently when I click on any item in the o2m list a form pops up showing the clicked item's data instead of simply being selected. Onchange does not get triggered in this situation.

How can I change this behavior?

Thank you!

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

By using @api.onchange or @api.dependans

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Thank you  Sehrish for your answer.

The problem when using your suggested approach is that currently when I click on any item in the o2m list a form pops up showing the clicked item's data instead of simply being selected. Onchange does not get triggered in this situation.

How can I stop this behavior?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

According to my understanding about your question.
For this question: Then how can I trigger some method in the model passing the ID(s) of the selected item(s)?
you can create a onchange method. When you select some record using (m2o, o2m) than onchange method triggered.

    @api.one
@api.onchange('the_field_which_you_have_selected')
def onchange_your_field(self):
        #do something

Hope this will helps you.

Reference: http://learnopenerp.blogspot.com

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
พ.ย. 16
4952
1
มี.ค. 15
4662
2
ก.ย. 23
5650
One2many domain on the selection แก้ไขแล้ว
5
ก.ค. 22
6050
1
มิ.ย. 18
5038