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

invoice multiplication/duplication

By
Carlos DuAl
on 3/14/16, 6:03 AM 303 views
Hello,

I'm trying to multiplicate/duplicate invoices because I want to stress-test it paying simultaneously a lot of them. I can duplicate an invoice from inside the actual invoice, but since I want to have 100-200s, there must be a more efficient way than duplicating them one by one. Is there a way to do so by code?
I've tried using
invoices = call('account.invoice','search_read', [('type','ilike',"out_invoice")])
for invoice in invoices:
    call('account.invoice', 'create', invoice)
But I'm getting this error

Traceback (most recent call last):  File "/home/carlos/Odoo/odoo/custom-addons/tests/test-seq-create-course-sessions/test.py", line 30, in <module> [ ... ]  File "/usr/lib/python2.7/xmlrpclib.py", line 794, in close    raise Fault(**self._stack[0])xmlrpclib.Fault: <Fault invalid input syntax for integer: "Sales Journal - (test) (EUR)"LINE 1: ...11', '0.00', NULL, NULL, 'SAJ/2016/008', ARRAY[1, 'Sales Jou...                                                                                                                                       ^

I'm assuming the error is that I'm duplicating an invoice with a previously used id (SAJ/2016/008) . I've tried changing the id but I'm still getting the exact same mistake.
invoices = call('account.invoice','search_read', [('type','ilike',"out_invoice")])
for invoice in invoices:
  replace='SAJ/2016/010' # new Id
  invoice['internal_number']=replace
  invoice['number']=replace
  call('account.invoice', 'create', invoice) 
 Any ideas on how to multiply/duplicate invoices?

Thank you
0
Juan
On 3/14/16, 7:17 AM

Try use the erppeek library



import erppeek
import functools
SERVER = 'http://localhost:8069'
DATABASE = 'DB'
USERNAME = 'admin'
PASSWORD = 'admin'
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])


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: 3/14/16, 6:03 AM
Seen: 303 times
Last updated: 3/14/16, 7:17 AM