Odoo Help

0

Is there a way to import products with a given Database ID ?

By
Xavier Brochard
on 10/8/16, 8:20 AM 336 views

For a project migrating from VirtueMart to Odoo, I need to keep the original Database ID in the product URL on the website. I need either to import products with their original Database ID or to change the product URL into something else using data from External ID or another field.

The simplest solution seems to change the product Database ID into the original one from VirtueMart. But how can I do that ? Can I edit tables in Postgresql without breaking all relational fields ? Is there a better solution ?

1
Hengky Zhang
On 10/11/16, 10:42 PM

in my opinion you can do that by external id

example : product.0011 --> (product.database_id)

then after that you can use query to update the database ID

update product_product set id = (select  name from ir_model_data imd where module = 'product' and res_id = product_product.id )

This seems the only practical solution. Thanks!

Xavier Brochard
on 10/18/16, 7:10 AM
0
Xavier Brochard
On 1/6/17, 8:20 AM

See this Daniel Reis answer on Stackoverflow http://stackoverflow.com/questions/34538959/in-odoo-what-is-an-external-id-and-what-are-its-uses/35686956 External IDs are stored in ir.model.data

IDs from product_templates are the ones used in URLs. One can import products directly in Postgresql tables product_template and product_product (which store product IDs related to product_template, like in variants). Then don't forget to update corresponding Postgresql's sequences with you last ID.

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 10/8/16, 8:20 AM
Seen: 336 times
Last updated: 1/6/17, 8:20 AM