sql_constraints should not be created for AbstractModel

Bug #1151703 reported by Guewen Baconnier @ Camptocamp
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Confirmed
Medium
OpenERP's Framework R&D
OpenERP Community Backports (Server)
Status tracked in 7.0
7.0
Fix Released
Undecided
Guewen Baconnier @ Camptocamp

Bug Description

Hi,

The ORM tries to create the SQL contraints on the AbstractModel models.

For an AbstractModel with _sql_contraints:

    class magento_binding(orm.AbstractModel):
        _name = 'magento.binding'
        _description = 'Magento Binding (abstract)'

        _columns = {
            'backend_id': fields.many2one(
                'magento.backend',
                'Magento Backend',
                required=True,
                ondelete='restrict'),
            'magento_id': fields.char('ID on Magento'),
        }

        _sql_constraints = [
            ('magento_uniq', 'unique(backend_id, magento_id)',
             'A record with same ID on Magento already exists.'),
        ]

Error during upgrade of the module:

2013-03-07 08:42:30,796 24916 ERROR openerp_magento7 openerp.sql_db: Programming error: relation "magento_binding" does not exist, in query ALTER TABLE "magento_binding" ADD CONSTRAINT "magento_binding_magento_uniq" unique(backend_id, magento_id

Of course, it can't create the constraint because the table does not exist.

Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Medium
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.