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

Hi,


We have created 2 tables. The first table has name as the column. User will fill this table. 

In the second table, I have I want to create a dropdown which takes the data source as all the names from the first table.


Is this possible?

Avatar
Abbandona
Risposta migliore

Yes for that you will use the Many2one relation to link between 2 models in Odoo. Write In your_module/models/models.py.

    class YourFirstModel(models.Model):

       _name = "first.model"

        name =fields.Char()


    class YourSecondModel(models.Model):

       _name = "second.model"

        name = fields.Char()

        options = fields.Many2one("first.model")



 Read more about how to build a relation in Odoo Docs here.


Happy to help :) an upvote will be awesome

Avatar
Abbandona
Autore

Hi Amr,

Thanks for the quick response. Can we do this without saving the first table?

Autore

Hi Amr,

Thanks for the quick response. Can we do this without saving the first table to database?

@Praveen Lobo

For all the dynamic drop down menus you have to build a table in the database thier is no other option and it's the best practice in odoo. For static menus you can use the Selection field

Autore Risposta migliore

A

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
giu 24
1702
2
mag 24
7803
3
feb 23
16320
0
mag 22
2094
4
apr 18
17745