Merge lp:~openerp-dev/openobject-addons/6.0-opw-575875-rha into lp:openobject-addons/6.0

Proposed by Rifakat Husen (OpenERP)
Status: Merged
Approved by: Naresh(OpenERP)
Approved revision: no longer in the source branch.
Merged at revision: 5423
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-575875-rha
Merge into: lp:openobject-addons/6.0
Diff against target: 71 lines (+53/-0)
2 files modified
stock/product.py (+2/-0)
stock/test/stock_test.yml (+51/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-575875-rha
Reviewer Review Type Date Requested Status
Naresh(OpenERP) (community) Approve
Numérigraphe (community) Approve
Review via email: mp+120088@code.launchpad.net

Description of the change

Hello,

Filling inventory for product without production lot then total qty
should return qty withouht production lot(prodlot_id==Null) but currently it does not distinguish
and retund all qty with and without lot. It leads to wrong creation of stock moves.

Please review this fix.

Regards,
Rifakat Haradwala

To post a comment you must log in.
Revision history for this message
Numérigraphe (numerigraphe) wrote :

Will you please backport the YML test from your 6.1 branch?

review: Needs Fixing (needs test backporting)
Revision history for this message
Rifakat Husen (OpenERP) (rha-openerp) wrote :

I think its not possible to backport same test from 6.1, could you please
check the test case which I have committed and provide your remark?

Thanks

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

That looks fine to me.
Thanks.

review: Approve
Revision history for this message
Naresh(OpenERP) (nch-openerp) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/product.py'
2--- stock/product.py 2012-06-19 07:42:50 +0000
3+++ stock/product.py 2012-10-23 11:26:21 +0000
4@@ -261,6 +261,8 @@
5 if prodlot_id:
6 prodlot_clause = ' and prodlot_id = %s '
7 where += [prodlot_id]
8+ elif 'prodlot_id' in context and not prodlot_id:
9+ prodlot_clause = 'and prodlot_id is null '
10
11 # TODO: perhaps merge in one query.
12 if 'in' in what:
13
14=== modified file 'stock/test/stock_test.yml'
15--- stock/test/stock_test.yml 2011-01-14 00:11:01 +0000
16+++ stock/test/stock_test.yml 2012-10-23 11:26:21 +0000
17@@ -345,3 +345,54 @@
18 'product_uom': move.product_uom.id,
19 }
20 self.do_partial(cr, uid, [ref('stock_picking_0')],partial_datas)
21+-
22+ Now I will do some test on HP Pavilion Desktop PCs to check the qty with and without Production Lot.
23+-
24+ !python {model: stock.change.standard.price}: |
25+ context.update({'active_model':'product.product', 'active_id': ref('product_product_hppaviliondesktoppcs0')})
26+-
27+ I am creating production lot '00001' for 'HP Pavilion Desktop PCs'
28+-
29+ !record {model: stock.production.lot, id: lot_hp_pc_1}:
30+ name: 00001
31+ product_id: product_product_hppaviliondesktoppcs0
32+-
33+ I update stock of 'HP Pavilion Desktop PCs' with 10 PCE in Stock with Production Lot.
34+-
35+ !record {model: stock.change.product.qty, id: update_qty_with_lot}:
36+ location_id: stock_location_stock
37+ new_quantity: 10
38+ product_id: product_product_hppaviliondesktoppcs0
39+ prodlot_id: lot_hp_pc_1
40+-
41+ Now I run the update wizard and update stock.
42+-
43+ !python {model: stock.change.product.qty}: |
44+ self.change_product_qty(cr, uid, [ref('update_qty_with_lot')], context=context)
45+-
46+ I check real stock of 'HP Pavilion Desktop PCs'.
47+-
48+ !python {model: product.product}: |
49+ product = self.browse(cr, uid, ref('product_product_hppaviliondesktoppcs0'), context=context)
50+ assert product.qty_available == 20, "Real stock is not 20 PCE."
51+-
52+ The current stock of the 'HP Pavilion Desktop PCs' is 20 PCE.
53+-
54+ !record {model: stock.change.product.qty, id: update_qty_nolot}:
55+ location_id: stock_location_stock
56+ new_quantity: 10
57+ product_id: product_product_hppaviliondesktoppcs0
58+-
59+ I try to update more 10 PCE in Stock without Production Lot.
60+-
61+ !python {model: stock.change.product.qty}: |
62+ self.change_product_qty(cr, uid, [ref('update_qty_nolot')], context=context)
63+-
64+ I again check real stock of 'HP Pavilion Desktop PCs'.
65+-
66+ !python {model: product.product}: |
67+ product = self.browse(cr, uid, ref('product_product_hppaviliondesktoppcs0'), context=context)
68+ assert product.qty_available == 20, "Real stock is updated with 10 more PCE."
69+-
70+ I confirm available stock of 'HP Pavilion Desktop PCs' is still 20 PCE.
71+