Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
5 Vastaukset
16179 Näkymät

I'm using Odoo v12.0 
I have added some attributes with values and i want to import my products from Excel file and use those attributes in it.

Problem is it won't let me because it can't find the attribute i'm using in Excel file,.

On the other hand if i use Odoo's default attributes it will import without errors.


Avatar
Hylkää
Paras vastaus

Hi Amin: 

You can do this in 3 steps.

  1. Go to Inventory > Configuration > Attributes and define the product attributes manually in Odoo. This is the attribute definition.

  2. Go to Inventory > Configuration > Attribute Values and use the import feature to import the valid attribute values.

  3. Go to Inventory > Master Data > Products and import the attribute values for each product.

You will need to create Excel templates for steps 2 and 3. Step 1 can be done manually if the number of attributes is small. If the number of attributes is large you can create a template for this too.

 Hope this helps.

Avatar
Hylkää
Paras vastaus
Hello,
you need to create the attribute in the product template configuration
this is an example:
if data['ATTRIBUTES']:

for attr in data['ATTRIBUTES']:

attribute, value = attribute.strip(), value.strip()

# Attribute get / create
attribute_id = Attribute.search([
('name', '=', attribute)
])
if not attribute_id:
attribute_id = Attribute.create({'name': attribute,
'create_variant': 'always'})
value_id = AttrValue.create({'name': value,
'attribute_id': attribute_id.id})

else:
# Attribute value get / create
value_id = attribute_id.value_ids \
.filtered(lambda attr_value: attr_value.name == value)

if not value_id:
value_id = AttrValue.create({'name': value,
'attribute_id': attribute_id.id})
value_ids.append(value_id.id)

# Attribute line get / create
attr_line_id = tmpl_id.attribute_line_ids.filtered(
lambda line: line.attribute_id.id == attribute_id.id
)
if not attr_line_id:
AttributeLine.create({
'product_tmpl_id': tmpl_id.id,
'attribute_id': attribute_id.id,
'value_ids': [(4, value_id.id)]
})
else:
attr_line_value_id = attr_line_id.filtered(
lambda line: value_id.id in line.value_ids.ids
)
if not attr_line_value_id:
attr_line_id.value_ids = [(4, value_id.id)]
Avatar
Hylkää
Paras vastaus

Hi, you can follow https://youtu.be/SgFmOD9Q2S4?si=46y7nPM_rumGs9NU

I hope it helps, thanks

Avatar
Hylkää
Paras vastaus

Hi Paresh,


I do not have an "Attribute Values" menu - do you know how to configure it?

Thank you,

Kristina

Avatar
Hylkää

You can directly import it from Attributes. Try to export [value_ids/id] and [value_ids/name], you can add extra line and fill and re-import.

Alternatively,
If you are familiar with parent-child relation and wanted to import it from Attribute Values, you can use Odoo Studio in order to add the menu.

Paras vastaus

Hi  Amin Dehghani,

I think this module can help you: https://apps.odoo.com/apps/modules/12.0/vks_import_excel

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

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
toukok. 25
364
1
heinäk. 24
1916
2
lokak. 23
1763
2
maalisk. 24
2365
1
helmik. 22
1812