openerp - Referencing objects before their actual definition (and the problems arising from this) -
this more of public service announcement question:
i implementing pretty big data model in openerp 6.1 , had problem object references defined before objects reference. simple solution define stubs of these objects containing nothing more "_name" attribute , "overwrite" these stubs actual object definition later on. interesting thing is, problem seems arise many2one , one2many relations. @ first many2many relations seem unaffected behaviour, though should. turns out still are, differently.
it seems, database table of target object of many2many relation created in addition mapping table, if not available already. when target objects definition read later on, fields added created database table. far, good. problem during creation of target objects database table id field omitted. since openerps database update routines seem not touch "supposed there" stuff, field never added table. results in error messages, telling e.g. openerp not able add foreign_key reference on table, should reference supposed there id field of target object.
tl;dr: create stubs object definitions, if objects referenced before actual definitions. else haunted this: programmingerror: there no primary key referenced table ...
yes, known issue openerp's older version v6 , v6.1, seems no longer v7. issue arises because of cyclic dependency have ref. of object on object b has ref. of object c has dependency on object a.
to avoid scenario, better refactor object dependencies, after issue still exist, can create initial declaration of tables contains it's name, , no _column
. let file loaded first , after other objects can follow.
Comments
Post a Comment