This question has been flagged
3 Replies
4711 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 ?

Avatar
Discard
Best Answer

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 )

Avatar
Discard
Author

This seems the only practical solution. Thanks!

Author Best Answer

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 your last ID.

Avatar
Discard