Skip to Content
Menú
This question has been flagged
2 Respostes
1504 Vistes

Hi everyone,

I was trying to create "many2many" field in "res.partner" and the comodel_name  is also res.partner. but while updating the module it shows.

AssertionError: res.partner.indi_joint_members_ids: Implicit/canonical naming of many2many relationship table is not possible when source and destination models are the same

its says that for same destination and source models it is not possible

here is the code

indi_joint_members_ids = fields.Many2many('res.partner',                                       									​relation_table='res_partner_res_partner_rel',
string="Individual / Joint Members",
store=True)

But i was able to create the same field from odoo front end with "ir.model.fields"  and the source and destination model is also same "res.partner" , well I tried to add values to it and its working(No Errors)
here is the screenshot.


"Solved this issue by creating field in "ir.model.fields" while installing the module with pre_init_hook And add the x_ field to the xml"  

------------------------------------------------------------------------------------------------------

But I am not sure this is the proper method to do it. Am i doing something wrong?

can anyone suggest a proper method to do it?


Thank You.

Avatar
Descartar
Autor Best Answer

Hi,

found the solution.

indi_joint_members_ids = fields.Many2many('res.partner',
relation="res_partner_res_partner_rel",
column1="id1",
column2="id2",
string="Individual / Joint Members",
store=True)

the above code works

Avatar
Descartar
Best Answer

Yes this is the correct way, i once had same requirement in product.product and product.template.

Avatar
Descartar
Related Posts Respostes Vistes Activitat
0
de febr. 20
5213
1
d’oct. 23
1393
0
de nov. 22
2297
0
de jul. 20
2461
0
de maig 20
6217