Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
5 Risposte
17094 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Risposta migliore
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
Abbandona
Risposta migliore

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

I hope it helps, thanks

Avatar
Abbandona
Risposta migliore

Hi Paresh,


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

Thank you,

Kristina

Avatar
Abbandona

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.

Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
mag 25
728
1
lug 24
2918
2
ott 23
2123
2
mar 24
2949
1
feb 22
2111