콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
2898 화면

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?

아바타
취소
베스트 답변

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

아바타
취소
작성자

Hi Amr,

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

작성자

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

작성자 베스트 답변

A

아바타
취소
관련 게시물 답글 화면 활동
2
6월 24
1728
2
5월 24
7829
3
2월 23
16358
0
5월 22
2111
4
4월 18
17767