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

Confirm and start an MO via python XML RPC

By
Ray Carnes
on 10/28/13, 6:30 PM 1,879 views

I need an XML-RPC snippet in python that confirms and/or starts an MO (v 6.1).

0

Ray Carnes

--Ray Carnes--
15717
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

Ray Carnes
On 10/28/13, 6:36 PM

1 Setup

import xmlrpclib

HOST = 'localhost'
PORT = 8069
DB = 'demo'
USER = 'admin'
PASS = 'admin'

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 "Logged in as %s (uid:%d)"%(USER,uid)

def execute(*args):
    return object_proxy.execute(DB, uid, PASS, *args)

3 Search

mo_ids = execute('mrp.production', 'search', [('state','=','draft')])
print mo_ids

4 Confirm & Produce

for mo in mo_ids:

    # confirm  MOs
    object_proxy.exec_workflow(DB,uid, PASS, 'mrp.production', 'button_confirm', mo)
    # You may want to add a step for Check availability or Force availability 

    # produce MOs
    object_proxy.exec_workflow(DB,uid, PASS, 'mrp.production', 'button_produce', mo)

Hey Ray,

Thanks for you post.

What would the last step be?

object_proxy.exec_workflow(DB,uid, PASS, 'mrp.production', 'button_produce_done', mo

would be to easy..:)

I need to find a way to call "action_produce". Then i would be able to change status and finish the production

cheers!

Moritz Schneider
on 3/14/14, 11:21 AM
0
Moritz Schneider
On 3/14/14, 11:20 AM

Hey Ray,

Thanks for you post.

What would the last step be?

object_proxy.exec_workflow(DB,uid, PASS, 'mrp.production', 'button_produce_done', mo

would be to easy..:)

I need to find a way to call "action_produce". Then i would be able to change status and finish the production

cheers!

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: 10/28/13, 6:30 PM
Seen: 1879 times
Last updated: 3/16/15, 8:10 AM