c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #25808
[Bug 793407] Re: [6.0 branch] IntegrityError: duplicate key value violates unique constraint "product_uom_factor_category_id_uniq"
I made a mistake: the DB was initially created with 6.1dev (trunk) and I
load my DB using 6.0 (stable) (as I have different versions on the same
server, sharing the same PostgreSQL instance)
I found that there is a new constraint added to product.uom that cause
problem. Please mark this for 6.1dev
addons/product/product.py
_sql_constraints = [
('factor_gt_zero', 'CHECK (factor!=0)', 'The conversion ratio for a unit of measure cannot be 0!'),
('factor_category_id_uniq', 'unique (category_id, factor)', 'You can not have more than one UOM with same factor for same UOM category'),
]
--
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:
[6.0 branch] IntegrityError: duplicate key value violates unique
constraint "product_uom_factor_category_id_uniq"
Status in OpenERP Modules (addons):
Incomplete
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á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/
References