← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 793407] Re: [trunk] IntegrityError: duplicate key value violates unique constraint "product_uom_factor_category_id_uniq"

 

This is the culprit (see the 2nd constraints)

2396         hda@tin |     _sql_constraints = [
3363.59.38   odo@ope |         ('factor_gt_zero', 'CHECK (factor!=0)', 'The conv
ersion ratio for a unit of measure cannot be 0!'),
4485.2.1     aag@tin |         ('factor_category_id_uniq', 'unique (category_id,
 factor)', 'You can not have more than one UOM with same factor for same UOM cat
egory'),
2396         hda@tin |     ]


** Changed in: openobject-addons
       Status: Invalid => New

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/793407

Title:
  [trunk] IntegrityError: duplicate key value violates unique constraint
  "product_uom_factor_category_id_uniq"

Status in OpenERP Modules (addons):
  New

Bug description:
  I experience this error when loading data into a newly created DB.
  This seems to be a regression as it doesn't happen on 6.0 release. I'm
  not sure that assuming the factor must be uniq per category is a
  valid.

  [2011-06-06 15:02:13,286][dev60] INFO:init:module crclinic_data: loading data/crclinic_data-product.uom.xml
  [2011-06-06 15:02:13,357][dev60] ERROR:db.cursor:bad query: insert into "product_uom" (id,"active","name","factor","rounding","category_id","uom_type",create_uid,create_date) values (15,E'True',E'cái',1.0,E'1.000',6,E'reference',1,now())
  Traceback (most recent call last):
    File "/media/data/Projects/openerp-6.0/server/bin/sql_db.py", line 131, in execute
      res = self._obj.execute(query, params)
  IntegrityError: duplicate key value violates unique constraint "product_uom_factor_category_id_uniq"

  [2011-06-06 15:02:13,358][dev60] ERROR:tools.convert.xml_import:Parse error in /media/data/Projects/openerp-6.0/server/bin/addons/crclinic_data/data/crclinic_data-product.uom.xml:55:
  <record id="product_uom_unit_cai" model="product.uom">
              <field name="category_id" ref="product_uom_categ_cai"/>
              <field name="name">c&#225;i</field>
              <field name="factor_inv" eval="1"/>
              <field name="factor" eval="1"/>
              <field name="rounding" eval="1"/>
              <field name="uom_type">reference</field>
              <field name="active">True</field>
          </record>
  Traceback (most recent call last):
    File "/media/data/Projects/openerp-6.0/server/bin/tools/convert.py", line 865, in parse
      self._tags[rec.tag](self.cr, rec, n)
    File "/media/data/Projects/openerp-6.0/server/bin/tools/convert.py", line 832, in _tag_record
      id = self.pool.get('ir.model.data')._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context )
    File "/media/data/Projects/openerp-6.0/server/bin/addons/base/ir/ir_model.py", line 691, in _update
      res_id = model_obj.create(cr, uid, values, context=context)
    File "/media/data/Projects/openerp-6.0/server/bin/addons/product/product.py", line 94, in create
      return super(product_uom, self).create(cr, uid, data, context)
    File "/media/data/Projects/openerp-6.0/server/bin/osv/orm.py", line 3649, in create
      cr.execute('insert into "'+self._table+'" (id'+upd0+") values ("+str(id_new)+upd1+')', tuple(upd2))
    File "/media/data/Projects/openerp-6.0/server/bin/sql_db.py", line 78, in wrapper
      return f(self, *args, **kwargs)
    File "/media/data/Projects/openerp-6.0/server/bin/sql_db.py", line 131, in execute
      res = self._obj.execute(query, params)
  IntegrityError: duplicate key value violates unique constraint "product_uom_factor_category_id_uniq"

  
  $ bzr version-info
  revision-id: launchpad_translations_on_behalf_of_openerp-20110606054349-hi2fwldkfbzht3rv
  date: 2011-06-06 05:43:49 +0000
  build-date: 2011-06-06 15:11:09 +0700
  revno: 4631
  branch-nick: addons

  $ bzr info
  Standalone tree (format: 2a)
  Location:
    branch root: .

  Related branches:
    parent branch: http://bazaar.launchpad.net/~openerp/openobject-addons/6.0/

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


References