← Back to team overview

openerp-india team mailing list archive

[Bug 1151703] Re: sql_constraints should not be created for AbstractModel

 

** Changed in: openobject-server
   Importance: Undecided => Medium

** Changed in: openobject-server
       Status: New => Confirmed

** Changed in: openobject-server
     Assignee: (unassigned) => OpenERP's Framework R&D (openerp-dev-framework)

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1151703

Title:
  sql_constraints should not be created for AbstractModel

Status in OpenERP Server:
  Confirmed

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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1151703/+subscriptions


References