"relationship already exists" after adding Many2many field to odoo

I have defined the following two ORM ORO models:

class Weekday(models.Model):
    _name = 'ludwik.offers.weekday'
    name = fields.Char()

class Duration(models.Model):
    _name = 'ludwik.offers.duration'
    weekday = fields.Many2many('ludwik.offers.weekday')

When I try to start odoo, I get the following message:

ProgrammingError: relation "ludwik_offers_duration_ludwik_offers_weekday_rel_ludwik_offers_" already exists

In addition, when I change the properties _namein the models, the problem persists (of course, the name of the relationship in the error message changes to reflect the renaming), so he does not like the conflict with only some old relationships that already exist in the database.

+4
source share
2 answers

I get it. I have to say, I think this technically qualifies as a bug in Odoo.

Summary

. , _name 16 , , .

Many2many, odoo , . :

  • <model1>_<model2>_rel_<model1>_id_index
  • <model1>_<model2>_rel_<model2>_id_index

<model1> <model2> - _name . _m2m_raise_or_create_relation odoo BaseModel.

. PostgreSQL ( ) 63 :

NAMEDATALEN-1 ; , . NAMEDATALEN 64, 63 .

Odoo . , PostgreSQL. 63 ( ), PostgreSQL . , , , ( , PostgreSQL).

, , _name, ? , m2m, , 16 .

16? PostgreSQL 63 . , , 15 . 48 , . , , 16 .

- relation Many2many.

+10

. , , ORM , .

, .

, . , , .

, , ludwik_offers , .

+1

All Articles