Merge lp:~camptocamp/openobject-addons/7.0-fix-do-partial-picking-20130425 into lp:openobject-addons/7.0

Proposed by Yannick Vaucher @ Camptocamp
Status: Needs review
Proposed branch: lp:~camptocamp/openobject-addons/7.0-fix-do-partial-picking-20130425
Merge into: lp:openobject-addons/7.0
Diff against target: 12 lines (+1/-1)
1 file modified
stock/wizard/stock_partial_picking.py (+1/-1)
To merge this branch: bzr merge lp:~camptocamp/openobject-addons/7.0-fix-do-partial-picking-20130425
Reviewer Review Type Date Requested Status
Amit Parik (community) Approve
OpenERP Core Team Pending
Review via email: mp+160877@code.launchpad.net

Description of the change

Fixes trying to make partial_data with False value as move ID in case of partial line without move_id

To post a comment you must log in.
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Yannick,

move_id and wizard_line.move_id.id both are same, see the line#170 move_id = wizard_line.move_id.id under the for wizard_line in partial.move_ids. So when there is no partial move id it will not exceute this code.

Also both have same value. So I didn't see any issue here. Hance the bug will be closed and I am rejecting the MP.
More comment on bug.

Thank you!

review: Disapprove
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Of course there is move_id = wizard_line.move_id.id
However, wizard_line.move_id.id can be false, move_id cannot as it is set when a move is created if move_id is false.

In http://bazaar.launchpad.net/~openerp/openobject-addons/7.0/view/head:/stock/wizard/stock_partial_picking.py

Let's say wizard_line.move_id is false

l170 move_id = wizard_line.move_id.id # we set false to move_id
...
l182 if move_id: # we do not enter here
...
l193 else: # but here
# so we create a new move and assign move_id
l195 move_id = stock_move.create(cr,uid,{'name' : self.pool.get('ir.sequence').get(cr, uid, seq_obj_name),

# here we use wizard_line.move_id.id which is false
l211 if (picking_type == 'in') and (wizard_line.product_id.cost_method == 'average'):
l212 partial_data['move%s' % (wizard_line.move_id.id)].update(product_price=wizard_line.cost,
l213 product_currency=wizard_line.currency.id)

--> Error as partial_data['movefalse'] doesn't exists

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

As per Amit comment on 2013-07-31 in bug report: review status isn't up to date

Revision history for this message
Amit Parik (amit-parik) wrote :

Ok, now its fine for me!

review: Approve
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Thanks for the review Amit

Unmerged revisions

9074. By Yannick Vaucher @ Camptocamp on 2013-04-25

[FIX] wrong variable used to construct partial_data in partial_picking wizard in do_partial_picking

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/wizard/stock_partial_picking.py'
2--- stock/wizard/stock_partial_picking.py 2012-12-17 15:23:03 +0000
3+++ stock/wizard/stock_partial_picking.py 2013-04-25 12:44:26 +0000
4@@ -209,7 +209,7 @@
5 'prodlot_id': wizard_line.prodlot_id.id,
6 }
7 if (picking_type == 'in') and (wizard_line.product_id.cost_method == 'average'):
8- partial_data['move%s' % (wizard_line.move_id.id)].update(product_price=wizard_line.cost,
9+ partial_data['move%s' % (move_id)].update(product_price=wizard_line.cost,
10 product_currency=wizard_line.currency.id)
11 stock_picking.do_partial(cr, uid, [partial.picking_id.id], partial_data, context=context)
12 return {'type': 'ir.actions.act_window_close'}