Odoo Help


import invoices directly into database

on 6/20/14, 3:57 AM 2,583 views

I'm migrating data from openerp 6 to openerp 7, I've chosen to do it directly into database because it's very fast. But I'm having a problem with invoices, they are all imported with the correct data, but I can't cancel them or pay them (actually I can pay them but the state doesn't change).

I found this link http://forum.openerp.com/forum/topic20397.html, the author of the topic had the same a problem as me, but I don't quite understand the answer. And why the problem doesn't occure with sales orders, delivery orders...?

I've tried using xml-rpc, but the sate is not imported, all my invoices are in draft state.

Any help is welcomed.


Ludo - Neobis

--Ludo - Neobis--
| 2 2 5
Hoogvliet, Netherlands
--Ludo - Neobis--


Ludo - Neobis
On 6/20/14, 6:47 AM

We have faced the same thing. Basically if you just import data into the database the ORM will not have attached any workflow to it. In other words, it will be a "dead" object.

The workflow is attached by the ORM when you create an object through the regular OpenERP way. The create does much more, but the most important thing is the workflow. 

If you use the XML-RPC connection to create new invoices, they will be just that; new invoices (so in draft state). A possibility would be to create all the invoices with XML-RPC and then using the newly created ids trigger the workflow. So basically you will be using the XML-RPC onnection to invoke the create method and then afterwards the method for the button to confirm the invoices.


The biggest downside to this import is the fact that some business logic might alter your invoices when buttons are pressed. You must always fill in the correct data (like in the case of the invoice; the invoice date) otherwise OpenERP uses the defaults for that, which is almost always incorrect in the case of historical import.

In short:

- Use XML-RPC to create invoices
- Use XML-RPC in a for loop over all the newly create invoices to trigger the method that confirms said invoices, just like you pressed the buttons by hand.


Thanks for the info. Do you have any suggestions on how to import [historical] invoices into Odoo 8.0 through the standard import/export functionality, or does this type of operation require bypassing the default import/export tools?

Luke Branch
on 3/28/15, 3:10 AM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/20/14, 3:57 AM
Seen: 2583 times
Last updated: 3/16/15, 8:10 AM