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
1=== modified file 'stock/wizard/stock_return_picking.py'
2--- stock/wizard/stock_return_picking.py 2012-06-12 16:15:51 +0000
3+++ stock/wizard/stock_return_picking.py 2013-01-21 09:17:22 +0000
4@@ -174,6 +174,8 @@
5 for v in val_id:
6 data_get = data_obj.browse(cr, uid, v, context=context)
7 mov_id = data_get.move_id.id
8+ if not mov_id:
9+ raise osv.except_osv(_('Warning !'), _("The creation of lines in the return picking wizard is not allowed. Please delete any lines you created."))
10 new_qty = data_get.quantity
11 move = move_obj.browse(cr, uid, mov_id, context=context)
12 new_location = move.location_dest_id.id