rvalyi/ooor — Issue #79: Impossible to create a product
Author: YannickB
Created: 2012-01-20 13:49:01+00:00
State: open

Hi,

When trying to create a product, it throw the following error :

*********** OpenERP Server ERROR ***********
operator does not exist: integer = boolean
LINE 1: ...d FROM "product_product" WHERE product_product.id IN (true, ...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

Traceback (most recent call last):
File "/home/openerp_user/openerp/destock_prod/server/bin/netsvc.py", line 489, in dispatch
result = ExportService.getService(service_name).dispatch(method, auth, params)
File "/home/openerp_user/openerp/destock_prod/server/bin/service/web_services.py", line 599, in dispatch
res = fn(db, uid, *params)
File "/home/openerp_user/openerp/destock_prod/server/bin/osv/osv.py", line 122, in wrapper
return f(self, dbname, *args, **kwargs)
File "/home/openerp_user/openerp/destock_prod/server/bin/osv/osv.py", line 176, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/openerp_user/openerp/destock_prod/server/bin/osv/osv.py", line 167, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/openerp_user/openerp/destock_prod/server/bin/osv/orm.py", line 2946, in read
result = self._read_flat(cr, user, select, fields, context, load)
File "/home/openerp_user/openerp/destock_prod/server/bin/osv/orm.py", line 3005, in _read_flat
cr.execute(query, (tuple(sub_ids),))
File "/home/openerp_user/openerp/destock_prod/server/bin/sql_db.py", line 78, in wrapper
return f(self, *args, **kwargs)
File "/home/openerp_user/openerp/destock_prod/server/bin/sql_db.py", line 131, in execute
res = self._obj.execute(query, params)
ProgrammingError: operator does not exist: integer = boolean
LINE 1: ...d FROM "product_product" WHERE product_product.id IN (true, ...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

********************************************

Postgres error :

2012-01-20 14:22:42 CET ERROR: operator does not exist: integer = boolean at character 649
2012-01-20 14:22:42 CET HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
2012-01-20 14:22:42 CET STATEMENT: SELECT product_product.ean13,product_product.magento_sku,product_product.track_production,product_product.updated_at,product_product.price_extra,product_product.set,product_product.default_code,product_product.name_template,product_product.variants,product_product.purchase_requisition,product_product.track_outgoing,product_product.product_tmpl_id,product_product.price_margin,product_product.track_incoming,product_product.active,product_product.magento_exportable,product_product.valuation,product_product.product_type,product_product.created_at,product_product.product_tmpl_id,product_product.id FROM "product_product" WHERE product_product.id IN (true, 22) ORDER BY default_code,name_template

My code on row script :

data = {
}

data['new_product_id'] = ProductProduct.create(
:name => $row["products_name"]
).id

$output << data

I also tried :

data = {
}
data['new_product_template_id'] = ProductTemplate.create(
:name => $row["products_name"]
).id

data['new_product_id'] = ProductProduct.create(
:product_tmpl_id => data['new_product_template_id']
).id

$output << data

I think the problem come from the inheritance between product.product and product.template. Maybe we need to make some particular manipulation in case of inherited object?