Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Consume product with specific quantity from specific source location in openerp

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 163
    Comment on it

    The quantity from specific source location with Consumed product and param product_qty means that Consumed product quantity and param location_id is Source location and returns Consumed lines in this function. Use the below function in .py file

    def action_consume(self, cr, uid, ids, product_qty, location_id=False, context=None):
    
            res = []
            production_obj = self.pool.get('mrp.production')
            wf_service = netsvc.LocalService("workflow")
            for move in self.browse(cr, uid, ids):
                move.action_confirm(context)
                new_moves = super(StockMove, self).action_consume(cr, uid, [move.id], product_qty, location_id, context=context)
                production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])])
                for prod in production_obj.browse(cr, uid, production_ids, context=context):
                    if prod.state == 'confirmed':
                        production_obj.force_production(cr, uid, [prod.id])
                    wf_service.trg_validate(uid, 'mrp.production', prod.id, 'button_produce', cr)
                for new_move in new_moves:
                    if new_move == move.id:
                        #This move is already there in move lines of production order
                        continue
                    production_obj.write(cr, uid, production_ids, {'move_lines': [(4, new_move)]})
                    res.append(new_move)
            return res
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: