[REF] clearer variable names
authorNumerigraphe - Lionel Sausin <ls@numerigraphe.fr>
Thu, 8 Mar 2012 08:31:39 +0000 (09:31 +0100)
committerNumerigraphe - Lionel Sausin <ls@numerigraphe.fr>
Thu, 8 Mar 2012 08:31:39 +0000 (09:31 +0100)
bzr revid: ls@numerigraphe.fr-20120308083139-hv80tnovazjrps14

addons/procurement/procurement.py

index 164314c..7dca3a8 100644 (file)
@@ -409,23 +409,24 @@ class procurement_order(osv.osv):
         return 0
 
     def action_cancel(self, cr, uid, ids):
-        """ Cancels procurement and writes move state to Assigned.
+        """Cancel Procurements and either cancel or assign the related Stock Moves, depending on the procurement configuration.
+        
         @return: True
         """
-        todo = []
-        todo2 = []
+        to_assign = []
+        to_cancel = []
         move_obj = self.pool.get('stock.move')
         for proc in self.browse(cr, uid, ids):
             if proc.close_move and proc.move_id:
                 if proc.move_id.state not in ('done', 'cancel'):
-                    todo2.append(proc.move_id.id)
+                    to_cancel.append(proc.move_id.id)
             else:
                 if proc.move_id and proc.move_id.state == 'waiting':
-                    todo.append(proc.move_id.id)
-        if len(todo2):
-            move_obj.action_cancel(cr, uid, todo2)
-        if len(todo):
-            move_obj.write(cr, uid, todo, {'state': 'assigned'})
+                    to_assign.append(proc.move_id.id)
+        if len(to_cancel):
+            move_obj.action_cancel(cr, uid, to_cancel)
+        if len(to_assign):
+            move_obj.write(cr, uid, to_assign, {'state': 'assigned'})
         self.write(cr, uid, ids, {'state': 'cancel'})
         wf_service = netsvc.LocalService("workflow")
         for id in ids: