This question has been flagged
4 Replies
6245 Views

It is easy to import such values into fields of type "text" by surrounding them by quotation marks, but it does not work for fields of type "char", all characters after a comma are lost.

I simply want to import product attribute values containing commas.

*** Update ***

he behaviour is strange enough: I was able to import the exact same value correctly into the field Value in the model product.attribute.value before without any problems (and without any quotes). The values are stored properly in the attribute values table. It only happens, when I try to import these values into the product templates.

Import into Attribute Values (working properly):


The field odooattribute_id is the External ID of the attribute.

This is how I want to import the corresponding values into the product templates (which works flawlessy, when the attribute values do not contain commas):


The external ID here is the External ID of the corresponding Product Template.

And this is the result:



The value to be imported gets truncated after the comma and therefore the corresponding value could not be found.

Meanwhile I did report an issue on Github: https://github.com/odoo/odoo/issues/27569

Any ideas/hints are very appreciated.

Avatar
Discard

Hi, did you found a solution ?

This is still an issue in latest version for imports and not only in products.

As you I tried Excel format without success

Best Answer

Hi  Ermin,

I think this video can help you:

https://www.youtube.com/watch?v=UOBxxnYDIsM&list=PLSKcWRTtEl5qzvRaI-VTGavfReiHS_EEb&index=1

Avatar
Discard
Best Answer

Import using another character, semicolon for example, and then import again changing only the name.

Avatar
Discard
Best Answer

Hello,

using below code you can achieve your goal.

import csv
with open("filepath/file.csv", "rb") as f:
    reader = csv.reader(f, delimiter="\t")
    for i, line in enumerate(reader):
        print 'line[{}] = {}'.format(i, line)  # here you can get result line by line into the list, comma separate value into the quote.

Avatar
Discard
Author

Thanks for your answer, but I'm afraid I can not follow you. I simply want to import product attribute values containing commas.

Best Answer

Dear  Ermin Trevisan

Try to import by using Excel File instead of CSV file.


I hope I helped you ...


Avatar
Discard
Author

Thanks for your answer. I did try it in several ways, none of them did work: as .xls and .xlsx files, without quotation marks, with single quotation marks, with double quotation marks. How does your Excel file looks like?