0

Hi I'd like to receive XML-files from a third party application. I thought of using REST, but this is not available in OpenERP 7. Any other solutions to do so. The XML-files contains Invoice data, when one is received a new record of the account.invoice has to be created.

ChesuCR
  • 9,352
  • 5
  • 51
  • 114
Jesse
  • 727
  • 13
  • 44

1 Answers1

2

Shared Folder via SFTP

Do you mean that you don´t have XMLRPC available? You can share a local server folder (by sftp for instance) and the third party application can leave the files there temporary. When you process the file you can already delete it.

Alternative to XMLRPC >> JSONRPC and Controllers

You can use controllers as well, but you need to use JSONRPC here. Maybe you can include the plain xml file into one JSON field.

But I think controllers were built only for OpenERP internal purposes. Check the problems I had about this: question1, question2

Note: Take into account that with this solution you will need to use only one database in the OpenERP instance.

Process XML File

If you want to read the XML file you can use the lxml library. Check this other answer:

After building an Element instance e from the XML, e.g. with the XML function, or by parsing a file with something like

import xml.etree.ElementTree
e = xml.etree.ElementTree.parse('thefile.xml').getroot()

or any of the many other ways shown at ElementTree, you just do something like:

for atype in e.findall('type'):
    print(atype.get('foobar'))
ChesuCR
  • 9,352
  • 5
  • 51
  • 114
  • Yes I'm aware of this solution but I find this less attractive. I'd like to use a RESTful service to transfer the XML data. I was wondering if there was a solution to use this with OpenERP V7 – Jesse Mar 20 '18 at 09:12
  • 1
    OK, I have added another option. Check if it is helpful for you – ChesuCR Mar 20 '18 at 09:34
  • Thanks, I'll look into this one – Jesse Mar 20 '18 at 10:35