~pexego/openobject-addons/6.1-pexego-sale_commission

« back to all changes in this revision

Viewing changes to full_stock_traceability/patches/stock.diff

  • Committer: Omar (pexego)
  • Date: 2012-07-27 08:40:22 UTC
  • Revision ID: omar@pexego.es-20120727084022-qp3ludpr3vsuyuf6
[ADD] Traceability modules ported to 6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
=== modified file 'stock/stock.py'
 
2
--- stock/stock.py      2012-03-27 08:34:40 +0000
 
3
+++ stock/stock.py      2012-04-27 08:53:24 +0000
 
4
@@ -2211,6 +2211,14 @@
 
5
         """ Makes the move done and if all moves are done, it will finish the picking.
 
6
         @return:
 
7
         """
 
8
+
 
9
+        partial_datas=''
 
10
+        partial_obj=self.pool.get('stock.partial.picking')
 
11
+        partial_id=partial_obj.search(cr,uid,[])
 
12
+
 
13
+        if partial_id:
 
14
+            partial_datas = partial_obj.read(cr, uid, partial_id, context=context)[0]
 
15
+
 
16
         picking_ids = []
 
17
         move_ids = []
 
18
         wf_service = netsvc.LocalService("workflow")
 
19
@@ -2236,6 +2244,10 @@
 
20
                 self.write(cr, uid, [move.id], {'move_history_ids': [(4, move.move_dest_id.id)]})
 
21
                 #cr.execute('insert into stock_move_history_ids (parent_id,child_id) values (%s,%s)', (move.id, move.move_dest_id.id))
 
22
                 if move.move_dest_id.state in ('waiting', 'confirmed'):
 
23
+                    if partial_datas and partial_datas['picking_id'][1][:2] == 'IN' and move.location_dest_id:
 
24
+                        self.write(cr, uid, [move.move_dest_id.id], {'location_dest_id': move.location_dest_id.id})
 
25
+                    if move.prodlot_id.id and move.product_id.id == move.move_dest_id.product_id.id:
 
26
+                        self.write(cr, uid, [move.move_dest_id.id], {'prodlot_id':move.prodlot_id.id})
 
27
                     self.force_assign(cr, uid, [move.move_dest_id.id], context=context)
 
28
                     if move.move_dest_id.picking_id:
 
29
                         wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
 
30
@@ -2243,6 +2255,12 @@
 
31
                         self.action_done(cr, uid, [move.move_dest_id.id], context=context)
 
32
 
 
33
             self._create_product_valuation_moves(cr, uid, move, context=context)
 
34
+            prodlot_id = partial_datas and partial_datas.get('move%s_prodlot_id' % (move.id), False)
 
35
+            if prodlot_id:
 
36
+                self.write(cr, uid, [move.id], {'prodlot_id': prodlot_id}, context=context)
 
37
+
 
38
+
 
39
+
 
40
             if move.state not in ('confirmed','done','assigned'):
 
41
                 todo.append(move.id)
 
42
 
 
43