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

Automatically Progressing Work Orders

By
Alex Gallien
on 8/20/14, 5:54 PM 473 views

Hi All,

I am looking to help make the Work Order process run more smoothly, and I think it would be nice if clicking the Finish button would automatically start the next item in the router sequence. I figure the best way to do this is to modify the action_done() functon in mrp_production_workcenter_line. This is the code I am using:

 

def action_done(self, cr, uid, ids, context=None):

        oper_obj = self.browse(cr, uid, ids)[0]

        prod_obj = oper_obj.production_id

        prod_seq = oper_obj.sequence

        prod_seq += 1

        next_step = self.pool.get('mrp_operations.operation').search(cr, uid, [('production_id','=',prod_obj),('sequence','=',prod_seq)])

        next_step.write(cr, uid, ids, {'state':'startworking'})

I still am struggling with understanding the various ways of accessing info from the database, I am pretty sure the line starting with 'next_step' is totally wrong, but I can't get the syntax right. It is not letting me increment prod_seq - I think I am pulling the data incorrectly.

    

Basically I just want to find the next item of the sequence and start it when an item is confirmed. Can anyone help me set that up? Or point me to documentation that explains .browse() / .get() / .search()? I can't seem to find any good explanations of the difference between and how to use those functions. Thanks! 

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: 8/20/14, 5:54 PM
Seen: 473 times
Last updated: 3/16/15, 8:10 AM