Merge lp:~openerp-dev/openobject-addons/trunk-opw-572997-port-mma into lp:openobject-addons

Proposed by Mayur Maheshwari(OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-opw-572997-port-mma
Merge into: lp:openobject-addons
Diff against target: 83 lines (+13/-6)
1 file modified
stock/stock.py (+13/-6)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-opw-572997-port-mma
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+136599@code.launchpad.net

Description of the change

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

To post a comment you must log in.

Unmerged revisions

8147. By Xavier ALT (OpenERP)

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

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-11-26 18:28:11 +0000
3+++ stock/stock.py 2012-11-28 09:14:20 +0000
4@@ -25,6 +25,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@@ -1290,6 +1291,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_name = pick.name
21@@ -1306,7 +1309,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@@ -1320,7 +1323,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 'prodlot_id': False,
37 'tracking_id': False,
38 })
39@@ -1336,7 +1339,7 @@
40 product_qty = move_product_qty[move.id]
41 defaults = {
42 'product_qty' : product_qty,
43- 'product_uos_qty': product_qty, #TODO: put correct uos_qty
44+ 'product_uos_qty': convert_to_uos(product_qty, to_uos),
45 'product_uom': product_uoms[move.id]
46 }
47 prodlot_id = prodlot_ids.get(move.id)
48@@ -2758,11 +2761,13 @@
49 })
50
51 for move in too_few:
52+ convert_to_uos = partial(uom_obj._compute_qty_obj, cr, uid, move.product_uom, context=context)
53+ to_uos = move.product_uos or move.product_uom
54 product_qty = move_product_qty[move.id]
55 if product_qty != 0:
56 defaults = {
57 'product_qty' : product_qty,
58- 'product_uos_qty': product_qty,
59+ 'product_uos_qty': convert_to_uos(product_qty, to_uos),
60 'picking_id' : move.picking_id.id,
61 'state': 'assigned',
62 'move_dest_id': False,
63@@ -2776,17 +2781,19 @@
64 self.write(cr, uid, [move.id],
65 {
66 'product_qty': move.product_qty - product_qty,
67- 'product_uos_qty': move.product_qty - product_qty,
68+ 'product_uos_qty': convert_to_uos(move.product_qty - product_qty, to_uos),
69 'prodlot_id': False,
70 'tracking_id': False,
71 })
72
73
74 for move in too_many:
75+ convert_to_uos = partial(uom_obj._compute_qty_obj, cr, uid, move.product_uom, context=context)
76+ to_uos = move.product_uos or move.product_uom
77 self.write(cr, uid, [move.id],
78 {
79 'product_qty': move.product_qty,
80- 'product_uos_qty': move.product_qty,
81+ 'product_uos_qty': convert_to_uos(move.product_qty, to_uos),
82 })
83 complete.append(move)
84

Subscribers

People subscribed via source and target branches

to all changes: