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
    • 190
    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

    1. def action_consume(self, cr, uid, ids, product_qty, location_id=False, context=None):
    2.  
    3. res = []
    4. production_obj = self.pool.get('mrp.production')
    5. wf_service = netsvc.LocalService("workflow")
    6. for move in self.browse(cr, uid, ids):
    7. move.action_confirm(context)
    8. new_moves = super(StockMove, self).action_consume(cr, uid, [move.id], product_qty, location_id, context=context)
    9. production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])])
    10. for prod in production_obj.browse(cr, uid, production_ids, context=context):
    11. if prod.state == 'confirmed':
    12. production_obj.force_production(cr, uid, [prod.id])
    13. wf_service.trg_validate(uid, 'mrp.production', prod.id, 'button_produce', cr)
    14. for new_move in new_moves:
    15. if new_move == move.id:
    16. #This move is already there in move lines of production order
    17. continue
    18. production_obj.write(cr, uid, production_ids, {'move_lines': [(4, new_move)]})
    19. res.append(new_move)
    20. return res

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: