From 31f3f8651031f4c4de3c16f6e90bf4d1f6619600 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Thu, 8 Dec 2011 15:25:59 +0530 Subject: [PATCH] [IMP]:check the flow when default UoM and purchase UoM is different bzr revid: ksa@tinyerp.com-20111208095559-9qt47pftmtr55yh1 --- addons/product/product_demo.xml | 23 ------------ addons/purchase/purchase_demo.xml | 7 ---- addons/purchase/purchase_order_demo.yml | 19 +++++++++- .../purchase/test/process/real_time_valuation.yml | 39 +++++++++++++++++--- 4 files changed, 51 insertions(+), 37 deletions(-) diff --git a/addons/product/product_demo.xml b/addons/product/product_demo.xml index a95b41e..3aebec1 100644 --- a/addons/product/product_demo.xml +++ b/addons/product/product_demo.xml @@ -636,20 +636,6 @@ - - SUGAR50KG - buy - - 110.0 - 3600.0 - - - SUGAR of 50KG - - product - - - @@ -791,15 +777,6 @@ 5 - - - 10 - 1 - 5 - - 5 - - diff --git a/addons/purchase/purchase_demo.xml b/addons/purchase/purchase_demo.xml index 406e8d8..6999f85 100644 --- a/addons/purchase/purchase_demo.xml +++ b/addons/purchase/purchase_demo.xml @@ -14,13 +14,6 @@ - - - - - - - diff --git a/addons/purchase/purchase_order_demo.yml b/addons/purchase/purchase_order_demo.yml index 8cd9271..0ea29b2 100644 --- a/addons/purchase/purchase_order_demo.yml +++ b/addons/purchase/purchase_order_demo.yml @@ -75,7 +75,22 @@ product_qty: 15 - - !record {model: purchase.order, id: order_purchase8}: + !record {model: product.product, id: product_sugar_id_50kg}: + default_code: SUGAR50KG + supply_method: buy + list_price: 110.0 + standard_price: 3600.0 + uom_id: product.product_uom_kgm + uom_po_id: product.product_uom_gram + name: SUGAR of 50KG + valuation: real_time + property_stock_account_input: account.o_expense + property_stock_account_output: account.o_income + categ_id: product.product_category_rawmaterial0 + +- + !record {model: purchase.order, id: order_purchase_sugar}: partner_id: base.res_partner_asus order_line: - - product_id: product.product_sugar_id_50kg + - product_id: product_sugar_id_50kg + diff --git a/addons/purchase/test/process/real_time_valuation.yml b/addons/purchase/test/process/real_time_valuation.yml index 69b0407..f023488 100644 --- a/addons/purchase/test/process/real_time_valuation.yml +++ b/addons/purchase/test/process/real_time_valuation.yml @@ -1,8 +1,37 @@ - - In order to test real time stock valuation flow, when default UoM and purchase UoM is different + In order to test real time stock valuation flow, I confirmed the purchase order. +- + !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase_sugar} +- + I check that the order which was initially in the draft state has transmit to approved state. +- + !assert {model: purchase.order, id: order_purchase_sugar}: + - state == 'approved' +- + In order to test check that picking is generated or not. - !python {model: purchase.order}: | - purchase_order = self.browse(cr, uid, ref("order_purchase8")) - assert len(purchase_order.order_line) == 1, "orderline should be generated." - for purchase_line in purchase_order.order_line: - assert purchase_line.price_unit == 3.6 ,"unit price is not same, got %s, expected 3.6"%(purchase_line.price_unit,) \ No newline at end of file + purchase_order = self.browse(cr, uid, ref("order_purchase_sugar")) + assert len(purchase_order.picking_ids) >= 1, "You should have only one reception order" + for picking in purchase_order.picking_ids: + assert picking.purchase_id.id == purchase_order.id +- + Reception is ready for process so now done the reception. +- + !python {model: stock.partial.picking}: | + pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("order_purchase_sugar")).picking_ids + partial_id = self.create(cr, uid, {},context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]}) + self.do_partial(cr, uid, [partial_id]) +- + Check the Journal having proper amount or not. +- + !python {model: account.move.line}: | + pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("order_purchase_sugar")).picking_ids + for data in pick_ids: + for moveline in data.move_lines: + ids = self.pool.get('account.move.line').search(cr, uid, [('ref','=',data.name),('partner_id','=',data.partner_id.id)]) + item_data = self.pool.get('account.move.line').browse(cr, uid, ids) + for item in item_data: + if item.account_id.id == moveline.product_id.property_stock_account_input.id: + assert item.credit == 3.6, "Journal items have not proper credit amount" + assert item.debit == 0.0, "Journal items have not proper debit amount" -- 1.7.10.4