Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Odoo 7:Copy property value to new product_template field

sql
By
chen rong
on 9/23/14, 1:23 AM 682 views

I want copy property filed list_price value to product_template list_price2

res_id  is product.template,id

insert into product_template (id, list_price2)
       select cast(substring(res_id from 18) as int) as id, value_float
              from ir_property where name='list_price';
ERROR:  null value in column "uom_id" violates not-null constraint
DETAIL:  Failing row contains (32645, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1).

 

0
chen rong
On 9/23/14, 2:05 AM

I solved it.

UPDATE product_template p2
SET list_price2 = p1.value_float
FROM ir_property p1
WHERE p2.id  = cast(substring(p1.res_id from 18) as int) and p1.name='list_price' 
AND p2.list_price2 IS DISTINCT FROM p1.value_float;

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/23/14, 1:23 AM
Seen: 682 times
Last updated: 3/16/15, 8:10 AM