This question has been flagged
2204 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! 

Avatar
Discard

I know this is an old post, but did anyone find the solution to this?