Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How do I load a large set of XML registers in Odoo v8?

By
E.M.
on 12/23/15, 5:56 AM 428 views

I have to load a large product catalog. Loading it via CSV is creating lots of issues due to base64 encoded image size so I would like to try importing the catalog via XML.


I know how to represent a product in XML, but I do not know how to load the actual XML. Once the XML file is prepared, how do I load it into Odoo v8?

Do I really need to create a module for this? I have large sets of records to load, having to install and reinstall all modules sounds weird. Is there any bulk load mechanism?

E.M.
on 12/23/15, 8:26 AM
1

Axel Mendoza

--Axel Mendoza--
10298
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 12/23/15, 6:23 AM

Take this as example of how to load an xml data in a module, at the end you just need to install the module:

File at the path views/data.xml

<?xml version="1.0" encoding="utf-8"?>

<openerp>

<data noupdate="1">

<record id="product_product_consultant" model="product.product">

<field name="categ_id" ref="product.product_category_5"/>

<field name="sale_ok" eval="True"/>

</record>

<record id="product_product_4" model="product.product">

<field name="name">iPad Retina Display</field>

<field name="categ_id" ref="ipad"/>

<field name="standard_price">500.0</field>

<field name="list_price">750.0</field>

<field name="type">consu</field>

<field name="uom_id" ref="product_uom_unit"/>

<field name="uom_po_id" ref="product_uom_unit"/>

<field name="description_sale">7.9‑inch (diagonal) LED-backlit, 128Gb

Dual-core A5 with quad-core graphics

FaceTime HD Camera, 1.2 MP Photos</field>

<field name="default_code">A2323</field>

<field name="attribute_value_ids" eval="[(6,0,[ref('product.product_attribute_value_1'), ref('product.product_attribute_value_3')])]"/>

</record>

<record id="product_product_4b" model="product.product">

<field name="default_code">A2324</field>

<field name="product_tmpl_id" ref="product_product_4_product_template"/>

<field name="attribute_value_ids" eval="[(6,0,[ref('product.product_attribute_value_1'), ref('product.product_attribute_value_4')])]"/>

</record>

</data>

</openerp>

Registered in __openerp__.py of your module like:

# -*- coding: utf-8 -*-

{

'name': 'Products Data',

'version': '1.1',

'author': 'OpenERP SA',

'depends': ['base', 'product'],

'website': 'https://www.odoo.com',

'description': """

""",

'data': [

'views/data.xml',

],

'installable': True,

'auto_install': False,

}

Do I really need to create a module for this? I have large sets of records to load, having to install and reinstall all modules sounds weird. Is there any bulk load mechanism?

E.M.
on 12/23/15, 8:26 AM

Until I know there is no other way that allow you to import the records doing the base64 encode

Axel Mendoza
on 12/23/15, 11:42 AM

There is the option of using XML RPC, I tried and it works (although it does not use XML). I also finally managed to find the issue in CSV and loaded all data through CSV. I anyway thank you for showing how to load data via XML, it might help in future.

E.M.
on 12/27/15, 8:21 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/23/15, 5:56 AM
Seen: 428 times
Last updated: 12/24/15, 7:05 AM