Merge lp:~openerp-dev/openobject-addons/6.1-opw-583796-cbi into lp:openobject-addons/6.1

Proposed by Chris Biersbach (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-583796-cbi
Merge into: lp:openobject-addons/6.1
Diff against target: 12 lines (+2/-0)
1 file modified
stock/wizard/stock_return_picking.py (+2/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-583796-cbi
Reviewer Review Type Date Requested Status
Niels Huylebroeck (community) Needs Information
OpenERP Core Team Pending
Review via email: mp+144072@code.launchpad.net

Description of the change

The issue: When creating lines using the return picking wizard, a traceback is caused.

The reason: There is no corresponding stock move for the newly created lines.

The fix: Logically, we would need to make the field read-only, which is not possible because the quantity in the pre-created lines needs to be editable. I thus added a test to see if there are any newly created lines. If so, I show a warning to tell the user to delete the new lines again, because he is not supposed to create any lines.

To post a comment you must log in.
Revision history for this message
Niels Huylebroeck (red15) wrote :

If there was no move_id for the newly created line the code on line 7 would've given an error already when trying to access the attribute '.id' ?

review: Needs Information

Unmerged revisions

7133. By Chris Biersbach (OpenERP)

[FIX] The retun picking wizard no longer causes an error when creating lines, but warns the user to remove any lines he has added.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'stock/wizard/stock_return_picking.py'
--- stock/wizard/stock_return_picking.py 2012-06-12 16:15:51 +0000
+++ stock/wizard/stock_return_picking.py 2013-01-21 09:17:22 +0000
@@ -174,6 +174,8 @@
174 for v in val_id:174 for v in val_id:
175 data_get = data_obj.browse(cr, uid, v, context=context)175 data_get = data_obj.browse(cr, uid, v, context=context)
176 mov_id = data_get.move_id.id176 mov_id = data_get.move_id.id
177 if not mov_id:
178 raise osv.except_osv(_('Warning !'), _("The creation of lines in the return picking wizard is not allowed. Please delete any lines you created."))
177 new_qty = data_get.quantity179 new_qty = data_get.quantity
178 move = move_obj.browse(cr, uid, mov_id, context=context)180 move = move_obj.browse(cr, uid, mov_id, context=context)
179 new_location = move.location_dest_id.id181 new_location = move.location_dest_id.id