Created
January 18, 2017 04:12
-
-
Save josemoralesp/81fe601ea1048b4e51a2a32095fc8e0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def validate_pickings(self, pickings): | |
"""Method used to validate pickings no matter the number of steps used in the picking process | |
""" | |
pick = pickings.filtered(lambda a: a.state in ('confirmed', 'assigned')) | |
# Confirming Pick | |
pick.action_confirm() | |
pick.action_assign() | |
value = self.trans.\ | |
with_context({'active_model': 'stock.picking', | |
'active_id': pick.id, | |
'active_ids': [pick.id]}).default_get([]) | |
line = [] | |
for ope in value.get('item_ids', []): | |
line.append((0, 0, ope)) | |
value['item_ids'] = line | |
value['picking_id'] = pick.id | |
# Creating an object of the pack window | |
trans_id = self.trans.create(value) | |
# Validating wizard | |
trans_id.do_detailed_transfer() | |
self.assertEqual(pick.state, 'done', 'The pick was not validated') | |
return pickings.filtered(lambda a: a.state in ('confirmed', 'assigned')) and validate_pickings(pickings) or pickings |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment