Good Morning
I present my problem, we are starting to climb all sales of a company to OpenERP from the portal, which already does leaving sales as "draft", I'm trying to use python code with XML-RPC to confirm all and any their way to deliver the product, but my problem is that I find as deliver products automatically, this is the code that I have for this::
ventas_workflow.py
import xmlrpclib
1 CONFIGURATION
HOST = 'localhost' PORT = 8069 DB = 'GMM' USER = 'admin' PASS = '123456'
url = 'http://%s:%d/xmlrpc/'%(HOST,PORT) object_proxy = xmlrpclib.ServerProxy(url+'object') common_proxy = xmlrpclib.ServerProxy(url+'common')
2 LOGIN
uid = common_proxy.login(DB,USER,PASS) print "" print "Login %s (uid:%d)"%(USER,uid) print ""
METHODS
def execute(*args): return object_proxy.execute(DB, uid, PASS, *args)
def workflow(*args): return object_proxy.exec_workflow(DB,uid, PASS, *args)
3 DRAFT SALES SEARCH
so_ids = execute('sale.order', 'search', [('state','=','draft')])
4 CONFIRMED SALES
for so in so_ids:
print "Id Sale # %s"%(so)
# confirm SOs
workflow('sale.order', 'order_confirm', so)
5 INVOICE
so_ids = execute('sale.order', 'search', [('state','=','manual')])
6 CREATE INVOICE
for so in so_ids:
print "Id Sale # %s"%(so)
# confirm SOs
workflow('sale.order', 'manual_invoice', so)
7 INVOICE STATE DRAFT
ai_ids = execute('account.invoice', 'search', [('state','=','draft'), ('type','=','out_invoice')])
8 VALIDATE INVOICE
for ai in ai_ids:
print "Id Invoice # %s"%(ai)
# confirm AIs
workflow('account.invoice', 'invoice_open', ai)
9 GET OUTSTANDING BY DELIVERING PRODUCTS
spo_ids = execute('stock.picking.out', 'search', [('state','=','confirmed'), ('type','=','out')])
10 DELIVER PRODUCT
for spo in spo_ids:
print "Id Picking out # %s"%(spo)
#workflow('stock.picking', 'action_assign', spo)
The process and does everything but can not find item 10 as running and do not know how to change the stock.picking of state "confirmed" to "assigned" because once in state "assigned" is used workflow "button_done" to deliver.
I hope you can advise me.
many Thanks
regards
Note: Google translation
Only use English on this site please. Thank you.
Ok, thanks, one question, is there a Spanish forum Open ERP?, regards.
How to call other functions in standard object except orm methods using xmlrpc