Merge lp:~openerp-dev/openobject-addons/6.0-opw-572997-ado into lp:openobject-addons/6.0

Proposed by Amit Dodiya (OpenERP)
Status: Approved
Approved by: Naresh(OpenERP)
Approved revision: 5152
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-572997-ado
Merge into: lp:openobject-addons/6.0
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.0-opw-572997-ado
Reviewer Review Type Date Requested Status
Naresh(OpenERP) (community) Approve
Xavier ALT Pending
Review via email: mp+98581@code.launchpad.net

Description of the change

Hello,

[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.

Code is Back-ported from trunk.

Regards,
Amit

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) :
review: Approve
5153. By Xavier ALT

[FIX] stock: fix partial picking UoS convertion - missing part

5154. By Xavier ALT

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

Revision history for this message
Numérigraphe (numerigraphe) wrote :

Has this been merged yet ?

Unmerged revisions

5154. By Xavier ALT

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

5153. By Xavier ALT

[FIX] stock: fix partial picking UoS convertion - missing part

5152. By Amit Dodiya (OpenERP)

    [FIX] stock : Fixing a uos qty problem

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/stock.py'
2--- stock/stock.py 2012-04-30 14:27:39 +0000
3+++ stock/stock.py 2012-04-30 16:27:21 +0000
4@@ -23,6 +23,7 @@
5 import time
6 from operator import itemgetter
7 from itertools import groupby
8+from functools import partial
9
10 from osv import fields, osv
11 from tools.translate import _
12@@ -1239,6 +1240,8 @@
13
14
15 for move in too_few:
16+ convert_to_uos = partial(uom_obj._compute_qty_obj, cr, uid, move.product_uom, context=context)
17+ to_uos = move.product_uos or move.product_uom
18 product_qty = move_product_qty[move.id]
19
20 if not new_picking:
21@@ -1251,7 +1254,7 @@
22 if product_qty != 0:
23 defaults = {
24 'product_qty' : product_qty,
25- 'product_uos_qty': product_qty, #TODO: put correct uos_qty
26+ 'product_uos_qty': convert_to_uos(product_qty, to_uos),
27 'picking_id' : new_picking,
28 'state': 'assigned',
29 'move_dest_id': False,
30@@ -1264,7 +1267,7 @@
31 move_obj.write(cr, uid, [move.id],
32 {
33 'product_qty' : move.product_qty - product_qty,
34- 'product_uos_qty':move.product_qty - product_qty, #TODO: put correct uos_qty
35+ 'product_uos_qty': convert_to_uos(move.product_qty - product_qty, to_uos),
36 })
37
38 if new_picking:
39@@ -1273,10 +1276,12 @@
40 if prodlot_ids.get(move.id):
41 move_obj.write(cr, uid, [move.id], {'prodlot_id': prodlot_ids[move.id]})
42 for move in too_many:
43+ convert_to_uos = partial(uom_obj._compute_qty_obj, cr, uid, move.product_uom, context=context)
44+ to_uos = move.product_uos or move.product_uom
45 product_qty = move_product_qty[move.id]
46 defaults = {
47 'product_qty' : product_qty,
48- 'product_uos_qty': product_qty, #TODO: put correct uos_qty
49+ 'product_uos_qty': convert_to_uos(product_qty, to_uos),
50 }
51 prodlot_id = prodlot_ids.get(move.id)
52 if prodlot_ids.get(move.id):
53@@ -2479,11 +2484,13 @@
54 })
55
56 for move in too_few:
57+ convert_to_uos = partial(uom_obj._compute_qty_obj, cr, uid, move.product_uom, context=context)
58+ to_uos = move.product_uos or move.product_uom
59 product_qty = move_product_qty[move.id]
60 if product_qty != 0:
61 defaults = {
62 'product_qty' : product_qty,
63- 'product_uos_qty': product_qty,
64+ 'product_uos_qty': convert_to_uos(product_qty, to_uos),
65 'picking_id' : move.picking_id.id,
66 'state': 'assigned',
67 'move_dest_id': False,
68@@ -2497,15 +2504,17 @@
69 self.write(cr, uid, [move.id],
70 {
71 'product_qty' : move.product_qty - product_qty,
72- 'product_uos_qty':move.product_qty - product_qty,
73+ 'product_uos_qty': convert_to_uos(move.product_qty - product_qty, to_uos),
74 })
75
76
77 for move in too_many:
78+ convert_to_uos = partial(uom_obj._compute_qty_obj, cr, uid, move.product_uom, context=context)
79+ to_uos = move.product_uos or move.product_uom
80 self.write(cr, uid, [move.id],
81 {
82 'product_qty': move.product_qty,
83- 'product_uos_qty': move.product_qty,
84+ 'product_uos_qty': convert_to_uos(move.product_qty, to_uos),
85 })
86 complete.append(move)
87