Merge lp:~alhashash/openobject-addons/7.0-bug-1164630-rounding_check_in_partial_picking into lp:openobject-addons/7.0

Proposed by Mohammad Alhashash
Status: Needs review
Proposed branch: lp:~alhashash/openobject-addons/7.0-bug-1164630-rounding_check_in_partial_picking
Merge into: lp:openobject-addons/7.0
Diff against target: 27 lines (+5/-2)
1 file modified
stock/wizard/stock_partial_picking.py (+5/-2)
To merge this branch: bzr merge lp:~alhashash/openobject-addons/7.0-bug-1164630-rounding_check_in_partial_picking
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+218386@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

10035. By Mohammad Alhashash

Fix bug lp:1164630 Picking partial delivery does not properly check rounding

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 2014-01-10 13:00:56 +0000
3+++ stock/wizard/stock_partial_picking.py 2014-05-06 11:12:01 +0000
4@@ -167,6 +167,7 @@
5 picking_type = partial.picking_id.type
6 for wizard_line in partial.move_ids:
7 line_uom = wizard_line.product_uom
8+ move_uom = wizard_line.move_id.product_uom
9 move_id = wizard_line.move_id.id
10
11 #Quantiny must be Positive
12@@ -174,11 +175,13 @@
13 raise osv.except_osv(_('Warning!'), _('Please provide proper Quantity.'))
14
15 #Compute the quantity for respective wizard_line in the line uom (this jsut do the rounding if necessary)
16- qty_in_line_uom = uom_obj._compute_qty(cr, uid, line_uom.id, wizard_line.quantity, line_uom.id)
17+ qty_in_move_uom = uom_obj._compute_qty(cr, uid, line_uom.id, wizard_line.quantity, move_uom.id)
18+ qty_in_line_uom = uom_obj._compute_qty(cr, uid, move_uom.id, qty_in_move_uom, line_uom.id)
19
20 if line_uom.factor and line_uom.factor <> 0:
21 if float_compare(qty_in_line_uom, wizard_line.quantity, precision_rounding=line_uom.rounding) != 0:
22- raise osv.except_osv(_('Warning!'), _('The unit of measure rounding does not allow you to ship "%s %s", only rounding of "%s %s" is accepted by the Unit of Measure.') % (wizard_line.quantity, line_uom.name, line_uom.rounding, line_uom.name))
23+ rounding = uom_obj._compute_qty(cr, uid, move_uom.id, move_uom.rounding, line_uom.id)
24+ raise osv.except_osv(_('Warning!'), _('The unit of measure rounding does not allow you to ship "%s %s", only rounding of "%s %s" is accepted by the Unit of Measure.') % (wizard_line.quantity, line_uom.name, rounding, line_uom.name))
25 if move_id:
26 #Check rounding Quantity.ex.
27 #picking: 1kg, uom kg rounding = 0.01 (rounding to 10g),