Xavier ALT (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw-572997-xal into 
lp:openobject-addons/6.1.

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/6.1-opw-572997-xal/+merge/103930

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.

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-572997-xal/+merge/103930
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-572997-xal.
=== modified file 'stock/stock.py'
--- stock/stock.py	2012-03-29 15:29:29 +0000
+++ stock/stock.py	2012-04-27 19:14:19 +0000
@@ -1254,6 +1254,7 @@
 
 
             for move in too_few:
+                uom_uos_diff = move.product_qty / move.product_uos_qty
                 product_qty = move_product_qty[move.id]
                 if not new_picking:
                     new_picking = self.copy(cr, uid, pick.id,
@@ -1265,7 +1266,7 @@
                 if product_qty != 0:
                     defaults = {
                             'product_qty' : product_qty,
-                            'product_uos_qty': product_qty, #TODO: put correct uos_qty
+                            'product_uos_qty': product_qty / uom_uos_diff,
                             'picking_id' : new_picking,
                             'state': 'assigned',
                             'move_dest_id': False,
@@ -1279,7 +1280,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': move.product_qty - partial_qty[move.id] / uom_uos_diff,
                             
                         })
 
@@ -1291,10 +1292,11 @@
                     defaults.update({'prodlot_id': prodlot_ids[move.id]})
                 move_obj.write(cr, uid, [move.id], defaults)
             for move in too_many:
+                uom_uos_diff = move.product_qty / move.product_uos_qty
                 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': product_qty / uom_uos_diff,
                     'product_uom': product_uoms[move.id]
                 }
                 prodlot_id = prodlot_ids.get(move.id)

_______________________________________________
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

Reply via email to