Mayur Maheshwari(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-opw-572997-port-mma into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
Related bugs:
Bug #938787 in OpenERP Addons: "[Trunk, 6.1]Partial picking changes UoS
quantity without converting to UoS"
https://bugs.launchpad.net/openobject-addons/+bug/938787
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-572997-port-mma/+merge/136599
Hello,
[FIX] stock : Fixing a uos quantity 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.
=> code is forward port from 6.1
Thanks,
Mayur
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-572997-port-mma/+merge/136599
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-opw-572997-port-mma.
=== modified file 'stock/stock.py'
--- stock/stock.py 2012-11-26 18:28:11 +0000
+++ stock/stock.py 2012-11-28 09:14:20 +0000
@@ -25,6 +25,7 @@
import time
from operator import itemgetter
from itertools import groupby
+from functools import partial
from osv import fields, osv
from tools.translate import _
@@ -1290,6 +1291,8 @@
for move in too_few:
+ convert_to_uos = partial(uom_obj._compute_qty_obj, cr, uid, move.product_uom, context=context)
+ to_uos = move.product_uos or move.product_uom
product_qty = move_product_qty[move.id]
if not new_picking:
new_picking_name = pick.name
@@ -1306,7 +1309,7 @@
if product_qty != 0:
defaults = {
'product_qty' : product_qty,
- 'product_uos_qty': product_qty, #TODO: put correct uos_qty
+ 'product_uos_qty': convert_to_uos(product_qty, to_uos),
'picking_id' : new_picking,
'state': 'assigned',
'move_dest_id': False,
@@ -1320,7 +1323,7 @@
move_obj.write(cr, uid, [move.id],
{
'product_qty': move.product_qty - partial_qty[move.id],
- 'product_uos_qty': move.product_qty - partial_qty[move.id], #TODO: put correct uos_qty
+ 'product_uos_qty': convert_to_uos(move.product_qty - partial_qty[move.id], to_uos),
'prodlot_id': False,
'tracking_id': False,
})
@@ -1336,7 +1339,7 @@
product_qty = move_product_qty[move.id]
defaults = {
'product_qty' : product_qty,
- 'product_uos_qty': product_qty, #TODO: put correct uos_qty
+ 'product_uos_qty': convert_to_uos(product_qty, to_uos),
'product_uom': product_uoms[move.id]
}
prodlot_id = prodlot_ids.get(move.id)
@@ -2758,11 +2761,13 @@
})
for move in too_few:
+ convert_to_uos = partial(uom_obj._compute_qty_obj, cr, uid, move.product_uom, context=context)
+ to_uos = move.product_uos or move.product_uom
product_qty = move_product_qty[move.id]
if product_qty != 0:
defaults = {
'product_qty' : product_qty,
- 'product_uos_qty': product_qty,
+ 'product_uos_qty': convert_to_uos(product_qty, to_uos),
'picking_id' : move.picking_id.id,
'state': 'assigned',
'move_dest_id': False,
@@ -2776,17 +2781,19 @@
self.write(cr, uid, [move.id],
{
'product_qty': move.product_qty - product_qty,
- 'product_uos_qty': move.product_qty - product_qty,
+ 'product_uos_qty': convert_to_uos(move.product_qty - product_qty, to_uos),
'prodlot_id': False,
'tracking_id': False,
})
for move in too_many:
+ convert_to_uos = partial(uom_obj._compute_qty_obj, cr, uid, move.product_uom, context=context)
+ to_uos = move.product_uos or move.product_uom
self.write(cr, uid, [move.id],
{
'product_qty': move.product_qty,
- 'product_uos_qty': move.product_qty,
+ 'product_uos_qty': convert_to_uos(move.product_qty, to_uos),
})
complete.append(move)
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp