I have 2 model, model_1
and model_2
,
the model_1
have Many2many fields
to model_2
, Odoo will automatically create a table with name model_1_model_2
to add relationship between model_1
and model_2
.
Is there any way I can create a tree view for model_1_model_2
table?
*Note
I want to do that, to import some data to this middle table generated by Odoo from some csv using Odoo import feature.
Unfortunately to create a view, You need to have model
and you need to have the Id
field.
so if you really need this you can alter the table and add the Id
column.
create a model with the same name as the relation with _auto = False
.
and create a the tree
view to import the data.
class RelModel(models.Model):
_name = 'some.name'
_tabel = 'same_name_in_the_database'
_auto = False
mode_1_id = ...Many2one.....
mode_2_id = ...Many2one.....
Hope you find another solution the problem with the tree view it require
the Id
field and by default relation table
in Odoo don't have that field
otherwise creating the model class for it is enough.