Merge lp:~yann-papouin/openobject-addons/7.0-bug-1104766-ignore-canceled-moves into lp:openobject-addons/7.0

Proposed by Yann Papouin
Status: Needs review
Proposed branch: lp:~yann-papouin/openobject-addons/7.0-bug-1104766-ignore-canceled-moves
Merge into: lp:openobject-addons/7.0
Diff against target: 26 lines (+6/-4)
1 file modified
stock/wizard/stock_return_picking.py (+6/-4)
To merge this branch: bzr merge lp:~yann-papouin/openobject-addons/7.0-bug-1104766-ignore-canceled-moves
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+210147@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

9885. By Yann Papouin

Ignore cancelled moves

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/wizard/stock_return_picking.py'
2--- stock/wizard/stock_return_picking.py 2013-09-09 15:25:01 +0000
3+++ stock/wizard/stock_return_picking.py 2014-03-10 08:58:38 +0000
4@@ -75,9 +75,10 @@
5 res.update({'invoice_state': 'none'})
6 return_history = self.get_return_history(cr, uid, record_id, context)
7 for line in pick.move_lines:
8- qty = line.product_qty - return_history.get(line.id, 0)
9- if qty > 0:
10- result1.append({'product_id': line.product_id.id, 'quantity': qty,'move_id':line.id, 'prodlot_id': line.prodlot_id and line.prodlot_id.id or False})
11+ if line.state <> 'cancel':
12+ qty = line.product_qty - return_history.get(line.id, 0)
13+ if qty > 0:
14+ result1.append({'product_id': line.product_id.id, 'quantity': qty,'move_id':line.id, 'prodlot_id': line.prodlot_id and line.prodlot_id.id or False})
15 if 'product_return_moves' in fields:
16 res.update({'product_return_moves': result1})
17 return res
18@@ -131,7 +132,8 @@
19 # a valid return move will be the exact opposite of ours:
20 # (src location, dest location) <=> (dest location, src location))
21 if rec.location_dest_id.id == m.location_id.id \
22- and rec.location_id.id == m.location_dest_id.id:
23+ and rec.location_id.id == m.location_dest_id.id \
24+ and rec.state != 'cancel':
25 return_history[m.id] += (rec.product_qty * rec.product_uom.factor)
26 return return_history
27