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 can I create an invoice with data from my own module? Odoo 8.0

By
Juan Muñoz
on 9/10/15, 4:49 AM 590 views

Hi all,

I have my own module which calls an API to get some data.

I just want pass this API data, located in my own module, to the invoice line to create a new invoice.

Thanks to all in advance! =)

-1

Drees Far

--Drees Far--
1130
| 5 2 6
Tunis, Tunisia
--Drees Far--
Drees Far
On 9/10/15, 6:23 AM

Hello my friend;

For this you need to work with XML_RPC or Curl.

Here are some examples and links to know how to work with:

XML_RPC:

Links:

https://doc.odoo.com/6.0/developer/6_22_XML-RPC_web_services/

http://thierry-godin.developpez.com/openerp/openerp-xmlrpc-php-fr/

http://thierry-godin.developpez.com/openerp/openerp-xmlrpc-php-en/

CURL:

Link:

https://www.odoo.com/fr_FR/forum/help-1/question/use-xmlrpc-webservice-through-cloud-version-of-odoo-55377

Example:

import pycurl, json

from StringIO import StringIO 

github_url = 'Your_api_link

buffer = StringIO()

c = pycurl.Curl()

c.setopt(pycurl.URL, github_url)

c.setopt(pycurl.HTTPHEADER, ['X-Postmark-Server-Token: API_TOKEN_HERE','Accept: application/json'])

c.setopt(c.WRITEFUNCTION, buffer.write)

c.perform()

c.close()

body = buffer.getvalue()

#print(body)

resp = json.loads(body)

if resp['result'] != 'ok' :

print 'Error : (' + resp['error_code'] +')' + resp['error']

else :

#print resp['list']

for gr in resp['list'] :

print gr['name']

Good LUCK & Regards.


please vote :)

Drees Far
on 9/10/15, 6:23 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: 9/10/15, 4:49 AM
Seen: 590 times
Last updated: 9/10/15, 6:23 AM