Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
4 Risposte
4081 Visualizzazioni

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!

Avatar
Abbandona
Risposta migliore

By using @api.onchange or @api.dependans

Avatar
Abbandona
Autore Risposta migliore

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?

Avatar
Abbandona
Risposta migliore

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

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
nov 16
4941
1
mar 15
4654
2
set 23
5626
5
lug 22
6027
1
giu 18
5029