Search code examples
pythonxml-rpcodoo-8

Mass invoices duplicate Odoo8


Is there anyway to duplicate, or create, a bunch of invoices with xml-rpc?

I try with the copy method of the Odoo ORMApi

invoices = call('account.invoice','search_read', [('type','ilike',"out_invoice")])

for invoice in invoices:
inv = invoice.copy()

How can I insert the new invoice int the db?


Solution

  • Try erppeek, it's a python library that makes this much easier

    client = erppeek.Client(SERVER, DATABASE, USERNAME, PASSWORD)
    invoices=client.search('account.invoice',[('type','ilike',"out_invoice")])
    for i in range(len(invoices)):
        client.copy('account.invoice',invoices[i-1])