From 8d6405a6605962042aec98e29a10ea0c8f595b7d Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Tue, 25 Oct 2011 14:15:30 +0530 Subject: [PATCH] [IMP]purchase: Improve code for validating the reception [RMV]stock: Remove the do_validate method bzr revid: dbr@tinyerp.com-20111025084530-8f8ejryly8a2jrvu --- .../purchase/test/process/rfq2order2done.yml | 8 ++++---- addons/stock/stock.py | 20 +------------------ 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/addons/purchase/test/process/rfq2order2done.yml b/addons/purchase/test/process/rfq2order2done.yml index b1e78da2f6e..b591abdb707 100644 --- a/addons/purchase/test/process/rfq2order2done.yml +++ b/addons/purchase/test/process/rfq2order2done.yml @@ -73,13 +73,13 @@ assert picking.move_lines[index].product_uos_qty == purchase_order.order_line[index].product_qty,"UOS Quantity is not correspond" assert picking.move_lines[index].product_uos == purchase_order.order_line[index].product_uom ,"UOS is not correspond" assert picking.move_lines[index].price_unit == purchase_order.order_line[index].price_unit ,"Price unit is not correspond" - - Reception is ready for process so now done the reception. - - !python {model: stock.picking}: | - pick_ids = self.search(cr, uid, [('purchase_id','=',ref('order_purchase1'))]) - self.do_validate(cr, uid, pick_ids) + !python {model: stock.partial.picking}: | + pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("order_purchase1")).picking_ids + partial_id = self.create(cr, uid, {},context={'active_model': 'stock.picking','active_ids': [pick_ids[1].id]}) + self.do_partial(cr, uid, [partial_id]) - I check that purchase order is shipped. - diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 1cded4b7786..ad40dff00e8 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1145,25 +1145,7 @@ class stock_picking(osv.osv): move_obj.unlink(cr, uid, ids2, ctx) return super(stock_picking, self).unlink(cr, uid, ids, context=context) - - def do_validate(self, cr, uid, ids, context=None): - """ - forcefully to validate picking with move lines - """ - for picking in self.browse(cr, uid, ids, context=context): - partial_datas = { - 'partner_id': picking.address_id.partner_id.id, - 'address_id': picking.address_id.id, - 'delivery_date' : time.strftime('%Y-%m-%d') - } - for move in picking.move_lines: - partial_datas['move%s'%(move.id)]= { - 'product_id': move.product_id, - 'product_qty': move.product_qty, - 'product_uom': move.product_uom.id, - } - val = self.do_partial(cr, uid, [picking.id], partial_datas, context=context) - return val + # FIXME: needs refactoring, this code is partially duplicated in stock_move.do_partial()! def do_partial(self, cr, uid, ids, partial_datas, context=None): """ Makes partial picking and moves done.