Mayur Maheshwari(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-opw-577110-port-mma into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-577110-port-mma/+merge/132505

Hello,

step for reproduce:- 

-. Modify product PC1 in "Make to Order" (Procurement Method).
-. Create a new sale order with PC1 (quantity 10).
-. Confirm sale order.
-. In production order, force reservation and start production
-. Produce and choice 4 in quantity, not 10.
-. Go in Delivery order split it into pack (4 and 6 quantity)click on the 
"Check Availability" and then process the order.
- This fix will make "Available" only produced quantity(that is pack with 4 
quantity) and pack with 6 will remain in "Waiting Availability" state.
   - Code is forward port from 6.1

Thanks,
Mayur



-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-577110-port-mma/+merge/132505
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-opw-577110-port-mma.
=== modified file 'stock/stock.py'
--- stock/stock.py	2012-10-29 09:17:13 +0000
+++ stock/stock.py	2012-11-01 10:44:19 +0000
@@ -2433,14 +2433,17 @@
             if move.picking_id:
                 picking_ids.append(move.picking_id.id)
             if move.move_dest_id.id and (move.state != 'done'):
-                self.write(cr, uid, [move.id], {'move_history_ids': [(4, move.move_dest_id.id)]})
-                #cr.execute('insert into stock_move_history_ids (parent_id,child_id) values (%s,%s)', (move.id, move.move_dest_id.id))
-                if move.move_dest_id.state in ('waiting', 'confirmed'):
-                    self.force_assign(cr, uid, [move.move_dest_id.id], context=context)
-                    if move.move_dest_id.picking_id:
-                        wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
-                    if move.move_dest_id.auto_validate:
-                        self.action_done(cr, uid, [move.move_dest_id.id], context=context)
+                # Downstream move should only be triggered if this move is the last pending upstream move
+                other_upstream_move_ids = self.search(cr, uid, [('id','!=',move.id),('state','not in',['done','cancel']),
+                                            ('move_dest_id','=',move.move_dest_id.id)], context=context)
+                if not other_upstream_move_ids:
+                    self.write(cr, uid, [move.id], {'move_history_ids': [(4, move.move_dest_id.id)]})
+                    if move.move_dest_id.state in ('waiting', 'confirmed'):
+                        self.force_assign(cr, uid, [move.move_dest_id.id], context=context)
+                        if move.move_dest_id.picking_id:
+                            wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
+                        if move.move_dest_id.auto_validate:
+                            self.action_done(cr, uid, [move.move_dest_id.id], context=context)
 
             self._create_product_valuation_moves(cr, uid, move, context=context)
             if move.state not in ('confirmed','done','assigned'):

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to