[FIX] orm,registry: properly check m2o FKs during model update + fix some models...
authorOlivier Dony <odo@openerp.com>
Mon, 17 Dec 2012 21:46:45 +0000 (22:46 +0100)
committerOlivier Dony <odo@openerp.com>
Mon, 17 Dec 2012 21:46:45 +0000 (22:46 +0100)
commit9f77d2e2f4b580e2fb07bc044c875dfd30008f44
tree7839e0e8ced7e6b60048769028219162d7f8927a
parentf827de704938686c5788c9041e9fe7ad1d268227
[FIX] orm,registry: properly check m2o FKs during model update + fix some models `auto_init`ed multiple times

The case where no constraint existed at all was not working,
and after fixing it, the ORM started to re-create the same
constraints multiple times for some modules. This was for
models that are split within a module (such as res.users in
base, which is made of several small classes): all the
partial models were going through _auto_init instead
of only the final one - doing useless extra work.

Unfortunately establishing the FK happens before the
XML data files are loaded, so a number of FK and
NOT NULL constraints failed to apply due to missing
tables/records. base.sql had to be extended a bit
to cover these cases in a minimalist fashion

bzr revid: odo@openerp.com-20121217214645-av9n003yzterhujw
openerp/addons/base/base.sql
openerp/addons/base/res/res_users.py
openerp/modules/registry.py
openerp/osv/orm.py