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

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

形象
丢弃
相关帖文 回复 查看 活动
2
11月 16
4969
1
3月 15
4670
2
9月 23
5694
5
7月 22
6067
1
6月 18
5057