Merge lp:~credativ/openobject-addons/6.1-lp-1033731 into lp:openobject-addons/6.1

Proposed by Craig Gowing (credativ)
Status: Needs review
Proposed branch: lp:~credativ/openobject-addons/6.1-lp-1033731
Merge into: lp:openobject-addons/6.1
Diff against target: 18 lines (+7/-1)
1 file modified
stock/stock.py (+7/-1)
To merge this branch: bzr merge lp:~credativ/openobject-addons/6.1-lp-1033731
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+157292@code.launchpad.net

Description of the change

Fix for lp:1033731

To post a comment you must log in.

Unmerged revisions

7199. By Craig Gowing (credativ)

[FIX] JIT may assign stock moves immediately, so only confirm moves if they are still draft

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/stock.py'
2--- stock/stock.py 2012-10-22 09:29:02 +0000
3+++ stock/stock.py 2013-04-05 07:41:24 +0000
4@@ -727,7 +727,13 @@
5
6 todo = self.action_explode(cr, uid, todo, context)
7 if len(todo):
8- self.pool.get('stock.move').action_confirm(cr, uid, todo, context=context)
9+ # JIT may assign stock moves immediately, so only confirm
10+ # moves if they are still draft
11+ move_obj = self.pool.get('stock.move')
12+ moves = move_obj.read(cr, uid, todo, ['id','state'], context=context)
13+ to_confirm = [ m['id'] for m in moves if m['state'] == 'draft' ]
14+ if len(to_confirm):
15+ self.pool.get('stock.move').action_confirm(cr, uid, to_confirm, context=context)
16 return True
17
18 def test_auto_picking(self, cr, uid, ids):