'Create the foreign keys recorded by _auto_init.'

@api.model_cr_context
def _auto_end(self):

    cr = self._cr
    query = 'ALTER    TABLE    "%s"    ADD    FOREIGN    KEY    ("%s")    REFERENCES    "%s"    ON    DELETE    %s'
    for (table1, column, table2, ondelete, module) in self._foreign_keys:
        cr.execute((query % (table1, column, table2, ondelete)))
        self._save_constraint(('%s_%s_fkey' % (table1, column)), 'f', False, module)
    cr.commit()
    del type(self)._foreign_keys
