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):
                new_moves = super(StockMove, self).action_consume(cr, uid, [], product_qty, location_id, context=context)
                production_ids =, uid, [('move_lines', 'in', [])])
                for prod in production_obj.browse(cr, uid, production_ids, context=context):
                    if prod.state == 'confirmed':
                        production_obj.force_production(cr, uid, [])
                    wf_service.trg_validate(uid, 'mrp.production',, 'button_produce', cr)
                for new_move in new_moves:
                    if new_move ==
                        #This move is already there in move lines of production order
                    production_obj.write(cr, uid, production_ids, {'move_lines': [(4, new_move)]})
            return res

 0 Comment(s)

Sign In

Sign up using

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: