This question has been flagged
2 Replies
3162 Views

Hello,

I'm littlebit new in odoo. I have an external webshop with the tree of categories. I need to import categories from the webshop to the odoo. With the API of the webshop I downloaded the category tree in XML format and I transported it to a CSV format. With the web gui import function I can import it. My question is that it is possible to load this CSV via XMLRPC (Erpeek) API in one step? I tried it but no success. I cannot using references (parent-child relations) or I not found the solution.

In my case the load function worked only for root categories, similar this:
ec.api.load('product.category', ['id','name','parent_id'], [['T1','Category1',None],['T2','Category2',None]])

Result:
/Category1
/Category2

In this case I viewed the metadata of the categories and I have found that the XML ID is of these categories are:
__import__.T1
__import__.T2

When I using XML ID with the load function is no working:

ec.api.load('product.category', ['id','name','parent_id'], [['T1','Category1',None],['T2','Category2','__import__.T1']])
Result:

none of categories loaded :-(

Best Regards,

Attila

Avatar
Discard
Best Answer

Try adding the suffix `:id` to the last field of the header . Maybe it works.

----

ec.api.load('product.category', ['id', 'name', 'parent_id:id'], [
['T1', 'Category1', None],
['T2', 'Category2', '__import__.T1'],
])

----
Avatar
Discard
Best Answer

Try adding the suffix `:id` to the last field of the header . Maybe it works.

----

ec.api.load('product.category', ['id', 'name', 'parent_id:id'], [
['T1', 'Category1', None],
['T2', 'Category2', '__import__.T1'],
])

----
Avatar
Discard