跳至內容
選單
此問題已被標幟
4 回覆
8755 瀏覽次數

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.

頭像
捨棄

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

最佳答案

Hi  Ermin,

I think this video can help you:

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

頭像
捨棄
最佳答案

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

頭像
捨棄
最佳答案

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.

頭像
捨棄
作者

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

最佳答案

Dear  Ermin Trevisan

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


I hope I helped you ...


頭像
捨棄
作者

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?

相關帖文 回覆 瀏覽次數 活動
4
3月 20
6296
1
10月 15
12118
2
3月 15
7814
3
6月 20
3878
1
11月 18
9379