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
=== modified file 'stock/product.py'
--- stock/product.py 2012-06-19 07:42:50 +0000
+++ stock/product.py 2012-10-23 11:26:21 +0000
@@ -261,6 +261,8 @@
261 if prodlot_id:261 if prodlot_id:
262 prodlot_clause = ' and prodlot_id = %s '262 prodlot_clause = ' and prodlot_id = %s '
263 where += [prodlot_id]263 where += [prodlot_id]
264 elif 'prodlot_id' in context and not prodlot_id:
265 prodlot_clause = 'and prodlot_id is null '
264266
265 # TODO: perhaps merge in one query.267 # TODO: perhaps merge in one query.
266 if 'in' in what:268 if 'in' in what:
267269
=== modified file 'stock/test/stock_test.yml'
--- stock/test/stock_test.yml 2011-01-14 00:11:01 +0000
+++ stock/test/stock_test.yml 2012-10-23 11:26:21 +0000
@@ -345,3 +345,54 @@
345 'product_uom': move.product_uom.id,345 'product_uom': move.product_uom.id,
346 }346 }
347 self.do_partial(cr, uid, [ref('stock_picking_0')],partial_datas)347 self.do_partial(cr, uid, [ref('stock_picking_0')],partial_datas)
348-
349 Now I will do some test on HP Pavilion Desktop PCs to check the qty with and without Production Lot.
350-
351 !python {model: stock.change.standard.price}: |
352 context.update({'active_model':'product.product', 'active_id': ref('product_product_hppaviliondesktoppcs0')})
353-
354 I am creating production lot '00001' for 'HP Pavilion Desktop PCs'
355-
356 !record {model: stock.production.lot, id: lot_hp_pc_1}:
357 name: 00001
358 product_id: product_product_hppaviliondesktoppcs0
359-
360 I update stock of 'HP Pavilion Desktop PCs' with 10 PCE in Stock with Production Lot.
361-
362 !record {model: stock.change.product.qty, id: update_qty_with_lot}:
363 location_id: stock_location_stock
364 new_quantity: 10
365 product_id: product_product_hppaviliondesktoppcs0
366 prodlot_id: lot_hp_pc_1
367-
368 Now I run the update wizard and update stock.
369-
370 !python {model: stock.change.product.qty}: |
371 self.change_product_qty(cr, uid, [ref('update_qty_with_lot')], context=context)
372-
373 I check real stock of 'HP Pavilion Desktop PCs'.
374-
375 !python {model: product.product}: |
376 product = self.browse(cr, uid, ref('product_product_hppaviliondesktoppcs0'), context=context)
377 assert product.qty_available == 20, "Real stock is not 20 PCE."
378-
379 The current stock of the 'HP Pavilion Desktop PCs' is 20 PCE.
380-
381 !record {model: stock.change.product.qty, id: update_qty_nolot}:
382 location_id: stock_location_stock
383 new_quantity: 10
384 product_id: product_product_hppaviliondesktoppcs0
385-
386 I try to update more 10 PCE in Stock without Production Lot.
387-
388 !python {model: stock.change.product.qty}: |
389 self.change_product_qty(cr, uid, [ref('update_qty_nolot')], context=context)
390-
391 I again check real stock of 'HP Pavilion Desktop PCs'.
392-
393 !python {model: product.product}: |
394 product = self.browse(cr, uid, ref('product_product_hppaviliondesktoppcs0'), context=context)
395 assert product.qty_available == 20, "Real stock is updated with 10 more PCE."
396-
397 I confirm available stock of 'HP Pavilion Desktop PCs' is still 20 PCE.
398