[FIX] fields: new-api many2many fields always determine their table and columns
The mechanism to determine the table and column names of new-api many2many fields only worked for many2many fields created from old-api many2many columns! This fixes #4851.
This commit is contained in:
parent
028458a87f
commit
a11100adb8
|
@ -1724,10 +1724,12 @@ class Many2many(_RelationalMulti):
|
|||
def _setup_regular(self, env):
|
||||
super(Many2many, self)._setup_regular(env)
|
||||
|
||||
if not self.relation:
|
||||
if isinstance(self.column, fields.many2many):
|
||||
if not self.relation and self.store:
|
||||
# retrieve self.relation from the corresponding column
|
||||
column = self.to_column()
|
||||
if isinstance(column, fields.many2many):
|
||||
self.relation, self.column1, self.column2 = \
|
||||
self.column._sql_names(env[self.model_name])
|
||||
column._sql_names(env[self.model_name])
|
||||
|
||||
if self.relation:
|
||||
m2m = env.registry._m2m
|
||||
|
|
Loading…
Reference in New Issue