From e04b82d240231a142dd6b2bcc5d141b55d782b0a Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Tue, 17 Sep 2013 14:46:48 +0200 Subject: [PATCH] [FIX] Lots of prints for fifo_price bzr revid: jco@openerp.com-20130917124648-irxcstmi9bn81ew3 --- addons/purchase/test/fifo_price.yml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/addons/purchase/test/fifo_price.yml b/addons/purchase/test/fifo_price.yml index 5b3210115f7..63b42706191 100644 --- a/addons/purchase/test/fifo_price.yml +++ b/addons/purchase/test/fifo_price.yml @@ -317,8 +317,13 @@ Process the delivery of the outgoing shipments - !python {model: stock.picking}: | + quant_obj = self.pool.get("stock.quant") + quants = quant_obj.search(cr, uid, [('product_id','=',ref("product_fifo_negative"))]) picking_obj1 = self.browse(cr, uid, ref("outgoing_fifo_shipment_neg2")) + print "Quants:", [(x.qty, x.location_id.name, x.in_date, x.cost, x.id) for x in quant_obj.browse(cr, uid, quants)] picking_obj1.do_partial(context=context) + quants = quant_obj.search(cr, uid, [('product_id','=',ref("product_fifo_negative"))]) + print "Quants:", [(x.qty, x.location_id.name, x.in_date, x.cost, x.id) for x in quant_obj.browse(cr, uid, quants)] - Receive purchase order with 50 kg FIFO Ice Cream at 50 euro/kg - @@ -340,12 +345,19 @@ Process the reception of purchase order 1 - !python {model: stock.picking}: | + quant_obj = self.pool.get("stock.quant") + quants = quant_obj.search(cr, uid, [('product_id','=',ref("product_fifo_negative"))]) picking_obj = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fifo_neg")).picking_ids[0] + quants = quant_obj.search(cr, uid, [('product_id','=',ref("product_fifo_negative"))]) + print "Quants:", [(x.qty, x.location_id.name, x.in_date, x.cost, x.id) for x in quant_obj.browse(cr, uid, quants)] picking_obj.do_partial(context=context) - Assert price on product is still the old price as the out move has not been received fully yet - !python {model: product.product}: | + quant_obj = self.pool.get("stock.quant") + quants = quant_obj.search(cr, uid, [('product_id','=',ref("product_fifo_negative"))]) + print "Quants:", [(x.qty, x.location_id.name, x.in_date, x.cost, x.id) for x in quant_obj.browse(cr, uid, quants)] assert self.browse(cr, uid, ref("product_fifo_negative")).standard_price == 70, 'The product price should not have been updated' - Receive purchase order with 60 kg FIFO Ice Cream at 80 euro/kg @@ -362,12 +374,15 @@ name: 'FIFO Ice Cream' - I confirm the second negative purchase order -- +- !workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_fifo_neg2} - Process the reception of purchase order 2 -- +- !python {model: stock.picking}: | + quant_obj = self.pool.get("stock.quant") + quants = quant_obj.search(cr, uid, [('product_id','=',ref("product_fifo_negative"))]) + print "Quants:", [(x.qty, x.location_id.name, x.in_date, x.cost, x.id) for x in quant_obj.browse(cr, uid, quants)] picking_obj = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fifo_neg2")).picking_ids[0] picking_obj.do_partial(context=context) - @@ -376,5 +391,5 @@ !python {model: product.product}: | quant_obj = self.pool.get("stock.quant") quants = quant_obj.search(cr, uid, [('product_id','=',ref("product_fifo_negative"))]) - print "Quants:", [(x.qty, x.location_id.name, x.in_date, x.cost) for x in quant_obj.browse(cr, uid, quants)] - assert self.browse(cr, uid, ref("product_fifo_negative")).standard_price == 65.0, "Product price not updated accordingly. %s found instead of 65" %(self.browse(cr, uid, ref("product_fifo_negative")).standard_price,) + print "Quants:", [(x.qty, x.location_id.name, x.in_date, x.cost, x.id) for x in quant_obj.browse(cr, uid, quants)] + assert self.browse(cr, uid, ref("product_fifo_negative")).standard_price == 65.0, "Product price not updated accordingly. %s found instead of 65" %(self.browse(cr, uid, ref("product_fifo_negative")).standard_price,) \ No newline at end of file