Odoo Help

0

Automatically Progressing Work Orders

By
Alex Gallien
on 8/20/14, 5:54 PM 513 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! 

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 8/20/14, 5:54 PM
Seen: 513 times
Last updated: 3/16/15, 8:10 AM