Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
3877 Vizualizări

Hello,

I have a table material_code I have fields like m_category, name, code.

I have an another table material_example I have same fields m_category, name, code.

I have to set the all the three fields as many2one which is related to the all three fields of the material_example.

But only one field can be set as many2one and it only takes "name" field from material_example.

How can I get all the three fields and relate them with?

Please help me with an example code

Thank you

Imagine profil
Abandonează
Cel mai bun răspuns

Hi Uppili Arivukkannu,

You can do this. you can declare more than one many2one field in model. please see bellow code:

Step-1: in material_code model

m_category = fields.Many2one('ModelName', string="Category")

name = fields.Many2one('ModelName', string="Name")

code = fields.Many2one('ModelName', string="Code")


Step-2: in material_example model

m_category = fields.One2many('ModelName', 'm_category')

name = fields.One2many('ModelName', 'name')

code = fields.One2many('ModelName', 'code')

Thank you..

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
dec. 19
9935
1
ian. 22
3439
0
mar. 16
3359
0
dec. 15
4371
0
dec. 15
5304