Se rendre au contenu
Menu
Cette question a été signalée
4 Réponses
8370 Vues

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
Ignorer

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

Meilleure réponse

Hi  Ermin,

I think this video can help you:

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

Avatar
Ignorer
Meilleure réponse

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

Avatar
Ignorer
Meilleure réponse

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
Ignorer
Auteur

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

Meilleure réponse

Dear  Ermin Trevisan

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


I hope I helped you ...


Avatar
Ignorer
Auteur

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?

Publications associées Réponses Vues Activité
4
mars 20
5982
1
oct. 15
11721
2
mars 15
7497
3
juin 20
3285
1
nov. 18
8789