[FIX] orm: custom m2m with different label
At rev 84e9a67cdf
a check to avoid the creation of ir.model.relation for custom modules was added. The condition is not correct as based on the string instead of the field name. We do not have access to column name at this level but the the m2m relation table do start with x_ for custom fields (see __init__ method).
This commit is contained in:
parent
67f1fd8a53
commit
437116f3c4
|
@ -3387,7 +3387,8 @@ class BaseModel(object):
|
|||
m2m_tbl, col1, col2 = f._sql_names(self)
|
||||
# do not create relations for custom fields as they do not belong to a module
|
||||
# they will be automatically removed when dropping the corresponding ir.model.field
|
||||
if not f.string.startswith('x_'):
|
||||
# table name for custom relation all starts with x_, see __init__
|
||||
if not m2m_tbl.startswith('x_'):
|
||||
self._save_relation_table(cr, m2m_tbl)
|
||||
cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (m2m_tbl,))
|
||||
if not cr.dictfetchall():
|
||||
|
|
Loading…
Reference in New Issue