Skip to Content
Menu
This question has been flagged
1 Reply
3471 Views

Hi, I observed a curious thing: 

I exported all product variants to a csv file to update two numbers for the warehouse (length and width). I then imported that csv file, but not under "product variants" > "Import records", but under "products" > "import records".

The exported ID was " __export__.product_product_43772_0d0d8199". I used this to update the products variant by importing the new csv under Products > Import records. 

But instead of updating, Odoo imported a completely new product with a completely new ID. 

The curious thing was, that all of the product variants I tried to update had a new external ID afterwards. The before mentioned product has "__export__.product_product_43772_b62b7404" now. As you can see, only the random part after the last underscore has changed. Same thing with the other IDs.

Does anyone know why that is? I am quite new in the Odoo world, though...

PS: I finally got it and exported the external IDs again, imported the data under "Products Variants" > "Import records" and  voila, it worked.

Avatar
Discard
Best Answer

Product templates and product variants are separate entities and have their own External IDs.

Let's try to figure out what happened:

1. You did export product_product (variants). By exporting, Odoo creates External IDs if not already defined. These IDs contain the string product_product. It might be that 43772 is the database ID, but I'm not sure. You can check it in the database table directly.

2. You did import your product_products into the product template data model (product_template). As you are completely free to define your own External IDs, Odoo simply accepted your product_product-Export IDs. But it created new product-templates, because you did import into the wrong data model. If an External ID does not exist in a data model, then Odoo creates a new record instead of updating an existing record.

3. When creating a new product_template record, Odoo automatically creates one new product_product (variant) record. This record gets a new product_product External ID when you export it again.


Avatar
Discard
Author

True, but this does not explain why the external ID of existing variants is changed after the import. I guess the number in "__export__.product_product_43772_0d0d8199" is the actual database ID... but what is the alphanumeric rest of it that does change?

The true database ID is an integer and is not related to an external ID.

Related Posts Replies Views Activity
4
Mar 15
9236
2
Nov 24
144
1
Nov 24
159
1
Oct 23
1176
3
Dec 23
18888