~unifield-team/unifield-wm/us-696-second-version

« back to all changes in this revision

Viewing changes to sync_so/picking.py

  • Committer: Quentin THEURET
  • Date: 2016-01-19 16:12:48 UTC
  • Revision ID: qt@tempo-consulting.fr-20160119161248-4swyma44h9z3m2qp
US-696 [FIX] Don't generate a not run message

Show diffs side-by-side

added added

removed removed

Lines of Context:
305
305
                        search_move = [('picking_id', '=', in_id), ('line_number', '=', data.get('line_number'))]
306
306
                        move_ids = move_obj.search(cr, uid, search_move, context=context)
307
307
                        if not move_ids:
308
 
                            message = "Line number " + str(ln) + " is not found in the original IN or PO"
309
 
                            self._logger.info(message)
310
 
                            raise Exception(message)
 
308
                            closed_in_id = so_po_common.get_in_id_by_state(cr, uid, po_id, po_name, ['done', 'cancel'], context)
 
309
                            search_move = [('picking_id', '=', closed_in_id), ('line_number', '=', data.get('line_number'))]
 
310
                            move_ids = move_obj.search(cr, uid, search_move, context=context)
 
311
                            if not move_ids:
 
312
                                message = "Line number " + str(ln) + " is not found in the original IN or PO"
 
313
                                self._logger.info(message)
 
314
                                raise Exception(message)
 
315
                            else:
 
316
                                in_data = self.read(cr, uid, closed_in_id[0], ['state', 'name'], context=context)
 
317
                                if in_data['state'] == 'done':
 
318
                                    message = "The IN " + in_data['name'] + " containing the line number " + str(ln) + " is already done"
 
319
                                else:
 
320
                                    message = "The IN " + in_data['name'] + " containing the line number " + str(ln) + " is canceled"
 
321
                                self._logger.info(message)
 
322
                                raise Exception(message)
311
323
 
312
324
                    move_id = False # REF-99: declare the variable before using it, otherwise if it go to else, then line 268 "if not move_id" -> problem!
313
325
                    if move_ids and len(move_ids) == 1:  # if there is only one move, take it for process