[IMP] orm: added comment, and delete an attribute when it is no more needed.

bzr revid: vmt@openerp.com-20110614084415-0noz6dlclnr09sbh
This commit is contained in:
Vo Minh Thu 2011-06-14 10:44:15 +02:00
parent 1b45a892dd
commit 75b8291486
1 changed files with 4 additions and 0 deletions

View File

@ -2545,6 +2545,8 @@ class orm(orm_template):
- alter existing database columns to match _columns,
- create database tables to match _columns,
- add database indices to match _columns,
- save in self._foreign_keys a list a foreign keys to create (see
_auto_end).
"""
self._foreign_keys = []
@ -2957,9 +2959,11 @@ class orm(orm_template):
return todo_end
def _auto_end(self, cr, context=None):
""" Create the foreign keys recorded by _auto_init. """
for t, k, r, d in self._foreign_keys:
cr.execute('ALTER TABLE "%s" ADD FOREIGN KEY ("%s") REFERENCES "%s" ON DELETE %s' % (t, k, r, d))
cr.commit()
del self._foreign_keys
@classmethod
def createInstance(cls, pool, cr):