Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. def validate_pickings(self, pickings):
  2. """Method used to validate pickings no matter the number of steps used in the picking process
  3. """
  4. pick = pickings.filtered(lambda a: a.state in ('confirmed', 'assigned'))
  5. # Confirming Pick
  6. pick.action_confirm()
  7. pick.action_assign()
  8. value = self.trans.\
  9. with_context({'active_model': 'stock.picking',
  10. 'active_id': pick.id,
  11. 'active_ids': [pick.id]}).default_get([])
  12. line = []
  13. for ope in value.get('item_ids', []):
  14. line.append((0, 0, ope))
  15.  
  16. value['item_ids'] = line
  17. value['picking_id'] = pick.id
  18. # Creating an object of the pack window
  19. trans_id = self.trans.create(value)
  20. # Validating wizard
  21. trans_id.do_detailed_transfer()
  22. self.assertEqual(pick.state, 'done', 'The pick was not validated')
  23. return pickings.filtered(lambda a: a.state in ('confirmed', 'assigned')) and validate_pickings(pickings) or pickings
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement