Merge lp:~openerp-dev/openobject-addons/6.1-opw-572997-xal into lp:openobject-addons/6.1

Proposed by Xavier ALT
Status: Approved
Approved by: Naresh(OpenERP)
Approved revision: 6774
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-572997-xal
Merge into: lp:openobject-addons/6.1
Diff against target: 86 lines (+15/-6)
1 file modified
stock/stock.py (+15/-6)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-572997-xal
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+103930@code.launchpad.net

Description of the change

Hello,

Forward-port of v6.0 fix made by Amit, see original merge comment below:

[FIX] stock : Fixing a uos qty problem

Steps:
1). Create a product with default_uom = g, quantity = 4000
2). Create sale order with above product with Quantity(UOM) = 4000 g, Quantity(UOS)=4 kg
3). Confirm the sale order, Open the related delivery order
4). Process it with Quantity = 500 g
5). Open the current delivery order line you will see the Quantity(UOM) = 3500 g and
Quantity(UOS) = 3500 kg, Quantity(UOS) should be 3.5 kg
6). Open the related backorder same issue here.

To post a comment you must log in.
6774. By Xavier ALT

[FIX] stock: correctly convert partial picking/move product UoS quantity based on product UoM quantity

Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Hello,

This bug was qualified as Confirmed on Trunk (means still existing and reproducible). A Merge Proposal for trunk was created to fix it. Here is the link to follow the MP on Launchpad https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-572997-port-mma/+merge/136599 and be informed once it's been merged in trunk: ... If this Merge Proposal could not be merged in v6.1 at the release of v7.0, it will be closed.

Thanks,
Naresh Soni

Unmerged revisions

6774. By Xavier ALT

[FIX] stock: correctly convert partial picking/move product UoS quantity based on product UoM quantity

6773. By Xavier ALT

[FIX] stock: fix partial picking UoS convertion

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'stock/stock.py'
--- stock/stock.py 2012-03-29 15:29:29 +0000
+++ stock/stock.py 2012-04-30 17:25:26 +0000
@@ -24,6 +24,7 @@
24import time24import time
25from operator import itemgetter25from operator import itemgetter
26from itertools import groupby26from itertools import groupby
27from functools import partial
2728
28from osv import fields, osv29from osv import fields, osv
29from tools.translate import _30from tools.translate import _
@@ -1254,6 +1255,8 @@
12541255
12551256
1256 for move in too_few:1257 for move in too_few:
1258 convert_to_uos = partial(uom_obj._compute_qty_obj, cr, uid, move.product_uom, context=context)
1259 to_uos = move.product_uos or move.product_uom
1257 product_qty = move_product_qty[move.id]1260 product_qty = move_product_qty[move.id]
1258 if not new_picking:1261 if not new_picking:
1259 new_picking = self.copy(cr, uid, pick.id,1262 new_picking = self.copy(cr, uid, pick.id,
@@ -1265,7 +1268,7 @@
1265 if product_qty != 0:1268 if product_qty != 0:
1266 defaults = {1269 defaults = {
1267 'product_qty' : product_qty,1270 'product_qty' : product_qty,
1268 'product_uos_qty': product_qty, #TODO: put correct uos_qty1271 'product_uos_qty': convert_to_uos(product_qty, to_uos),
1269 'picking_id' : new_picking,1272 'picking_id' : new_picking,
1270 'state': 'assigned',1273 'state': 'assigned',
1271 'move_dest_id': False,1274 'move_dest_id': False,
@@ -1279,7 +1282,7 @@
1279 move_obj.write(cr, uid, [move.id],1282 move_obj.write(cr, uid, [move.id],
1280 {1283 {
1281 'product_qty' : move.product_qty - partial_qty[move.id],1284 'product_qty' : move.product_qty - partial_qty[move.id],
1282 'product_uos_qty': move.product_qty - partial_qty[move.id], #TODO: put correct uos_qty1285 'product_uos_qty': convert_to_uos(move.product_qty - partial_qty[move.id], to_uos),
1283 1286
1284 })1287 })
12851288
@@ -1291,10 +1294,12 @@
1291 defaults.update({'prodlot_id': prodlot_ids[move.id]})1294 defaults.update({'prodlot_id': prodlot_ids[move.id]})
1292 move_obj.write(cr, uid, [move.id], defaults)1295 move_obj.write(cr, uid, [move.id], defaults)
1293 for move in too_many:1296 for move in too_many:
1297 convert_to_uos = partial(uom_obj._compute_qty_obj, cr, uid, move.product_uom, context=context)
1298 to_uos = move.product_uos or move.product_uom
1294 product_qty = move_product_qty[move.id]1299 product_qty = move_product_qty[move.id]
1295 defaults = {1300 defaults = {
1296 'product_qty' : product_qty,1301 'product_qty' : product_qty,
1297 'product_uos_qty': product_qty, #TODO: put correct uos_qty1302 'product_uos_qty': convert_to_uos(product_qty, to_uos),
1298 'product_uom': product_uoms[move.id]1303 'product_uom': product_uoms[move.id]
1299 }1304 }
1300 prodlot_id = prodlot_ids.get(move.id)1305 prodlot_id = prodlot_ids.get(move.id)
@@ -2562,11 +2567,13 @@
2562 })2567 })
25632568
2564 for move in too_few:2569 for move in too_few:
2570 convert_to_uos = partial(uom_obj._compute_qty_obj, cr, uid, move.product_uom, context=context)
2571 to_uos = move.product_uos or move.product_uom
2565 product_qty = move_product_qty[move.id]2572 product_qty = move_product_qty[move.id]
2566 if product_qty != 0:2573 if product_qty != 0:
2567 defaults = {2574 defaults = {
2568 'product_qty' : product_qty,2575 'product_qty' : product_qty,
2569 'product_uos_qty': product_qty,2576 'product_uos_qty': convert_to_uos(product_qty, to_uos),
2570 'picking_id' : move.picking_id.id,2577 'picking_id' : move.picking_id.id,
2571 'state': 'assigned',2578 'state': 'assigned',
2572 'move_dest_id': False,2579 'move_dest_id': False,
@@ -2580,15 +2587,17 @@
2580 self.write(cr, uid, [move.id],2587 self.write(cr, uid, [move.id],
2581 {2588 {
2582 'product_qty' : move.product_qty - product_qty,2589 'product_qty' : move.product_qty - product_qty,
2583 'product_uos_qty':move.product_qty - product_qty,2590 'product_uos_qty': convert_to_uos(move.product_qty - product_qty, to_uos),
2584 })2591 })
25852592
25862593
2587 for move in too_many:2594 for move in too_many:
2595 convert_to_uos = partial(uom_obj._compute_qty_obj, cr, uid, move.product_uom, context=context)
2596 to_uos = move.product_uos or move.product_uom
2588 self.write(cr, uid, [move.id],2597 self.write(cr, uid, [move.id],
2589 {2598 {
2590 'product_qty': move.product_qty,2599 'product_qty': move.product_qty,
2591 'product_uos_qty': move.product_qty,2600 'product_uos_qty': convert_to_uos(move.product_qty, to_uos),
2592 })2601 })
2593 complete.append(move)2602 complete.append(move)
25942603