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

import invoices directly into database

By
Wided
on 6/20/14, 3:57 AM 1,746 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.

1

Ludo - Neobis

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

Developer

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.

@Ludo,

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

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: 6/20/14, 3:57 AM
Seen: 1746 times
Last updated: 3/16/15, 8:10 AM