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
1=== modified file 'stock/stock.py'
2--- stock/stock.py 2012-03-29 15:29:29 +0000
3+++ stock/stock.py 2012-04-30 17:25:26 +0000
4@@ -24,6 +24,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@@ -1254,6 +1255,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 if not new_picking:
20 new_picking = self.copy(cr, uid, pick.id,
21@@ -1265,7 +1268,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@@ -1279,7 +1282,7 @@
31 move_obj.write(cr, uid, [move.id],
32 {
33 'product_qty' : move.product_qty - partial_qty[move.id],
34- 'product_uos_qty': move.product_qty - partial_qty[move.id], #TODO: put correct uos_qty
35+ 'product_uos_qty': convert_to_uos(move.product_qty - partial_qty[move.id], to_uos),
36
37 })
38
39@@ -1291,10 +1294,12 @@
40 defaults.update({'prodlot_id': prodlot_ids[move.id]})
41 move_obj.write(cr, uid, [move.id], defaults)
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 'product_uom': product_uoms[move.id]
51 }
52 prodlot_id = prodlot_ids.get(move.id)
53@@ -2562,11 +2567,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@@ -2580,15 +2587,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