← Back to team overview

openerp-community-reviewer team mailing list archive

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

 

Yann Papouin has proposed merging lp:~yann-papouin/ocb-addons/7.0-bug-1104766-ignore-canceled-moves into lp:ocb-addons.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #1104766 in OpenERP Community Backports (Addons): "Product Return Canceled"
  https://bugs.launchpad.net/ocb-addons/+bug/1104766

For more details, see:
https://code.launchpad.net/~yann-papouin/ocb-addons/7.0-bug-1104766-ignore-canceled-moves/+merge/210162

Automatically derived from https://code.launchpad.net/~yann-papouin/openobject-addons/7.0-bug-1104766-ignore-canceled-moves for https://code.launchpad.net/~openerp/openobject-addons/7.0.
-- 
https://code.launchpad.net/~yann-papouin/ocb-addons/7.0-bug-1104766-ignore-canceled-moves/+merge/210162
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~yann-papouin/ocb-addons/7.0-bug-1104766-ignore-canceled-moves into lp:ocb-addons.
=== modified file 'stock/wizard/stock_return_picking.py'
--- stock/wizard/stock_return_picking.py	2013-09-10 07:20:14 +0000
+++ stock/wizard/stock_return_picking.py	2014-03-10 09:49:25 +0000
@@ -75,9 +75,10 @@
                     res.update({'invoice_state': 'none'})
             return_history = self.get_return_history(cr, uid, record_id, context)       
             for line in pick.move_lines:
-                qty = line.product_qty - return_history.get(line.id, 0)
-                if qty > 0:
-                    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})
+                if line.state <> 'cancel':
+                    qty = line.product_qty - return_history.get(line.id, 0)
+                    if qty > 0:
+                        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})
             if 'product_return_moves' in fields:
                 res.update({'product_return_moves': result1})
         return res
@@ -131,7 +132,8 @@
                     # a valid return move will be the exact opposite of ours:
                     #     (src location, dest location) <=> (dest location, src location))
                     if rec.location_dest_id.id == m.location_id.id \
-                        and rec.location_id.id == m.location_dest_id.id:
+                        and rec.location_id.id == m.location_dest_id.id \
+                        and rec.state != 'cancel':
                         return_history[m.id] += (rec.product_qty * rec.product_uom.factor)
         return return_history
 


Follow ups