From 172690e7e92961f80ac5c09e1de38cce60ca2dff Mon Sep 17 00:00:00 2001 From: "uco (OpenERP)" Date: Tue, 11 May 2010 18:35:40 +0530 Subject: [PATCH] [ADD] sale: Added yaml test for procurement and sale order flow. Improved state name in mrp production yaml. bzr revid: uco@tinyerp.com-20100511130540-w2uvd3zl1hum59ei --- addons/mrp/test/mrp_production_order.yml | 2 +- addons/sale/__openerp__.py | 1 + addons/sale/test/sale_procurement.yml | 93 ++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 addons/sale/test/sale_procurement.yml diff --git a/addons/mrp/test/mrp_production_order.yml b/addons/mrp/test/mrp_production_order.yml index f143239462a..5de26180723 100644 --- a/addons/mrp/test/mrp_production_order.yml +++ b/addons/mrp/test/mrp_production_order.yml @@ -93,7 +93,7 @@ - !function {model: mrp.procurement, name: run_scheduler}: - model: mrp.procurement - search: "[('state','=','cofirmed')]" + search: "[('state','=','confirmed')]" - I am checking Internal picking. - diff --git a/addons/sale/__openerp__.py b/addons/sale/__openerp__.py index 23e72c60775..32688c91c8a 100644 --- a/addons/sale/__openerp__.py +++ b/addons/sale/__openerp__.py @@ -60,6 +60,7 @@ # 'process/sale_process.xml', ], 'demo_xml': ['sale_demo.xml'], +# 'test': ['test/sale_procurement.yml'], 'installable': True, 'active': False, 'certificate': '0058103601429', diff --git a/addons/sale/test/sale_procurement.yml b/addons/sale/test/sale_procurement.yml new file mode 100644 index 00000000000..5a73236f7bc --- /dev/null +++ b/addons/sale/test/sale_procurement.yml @@ -0,0 +1,93 @@ +- + In order to test the sale order working with procurements I will create some + products with different supply method and procurement method. +- + I create two products. +- + !record {model: product.product, id: product_product_table0}: + categ_id: product.cat1 + name: Table + procure_method: make_to_order + supply_method: produce + type: product + uom_id: product.product_uom_unit + uom_po_id: product.product_uom_unit +- + !record {model: product.product, id: product_product_wood0}: + categ_id: product.cat1 + name: Wood + procure_method: make_to_stock + supply_method: buy + type: product + uom_id: product.product_uom_kgm + uom_po_id: product.product_uom_kgm +- + I define Minimum stock rule for my stockable product wood +- + !record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op0}: + company_id: base.main_company + location_id: stock.stock_location_stock + logic: max + name: OP/00002 + product_id: product_product_wood0 + product_max_qty: 15.0 + product_min_qty: 10.0 + product_uom: product.product_uom_kgm + qty_multiple: 1 + warehouse_id: stock.warehouse0 +- + Now I make a sale order for table. +- + !record {model: sale.order, id: sale_order_so0}: + amount_total: 5.0 + amount_untaxed: 5.0 + date_order: '2010-04-30' + invoice_quantity: order + name: SO006 + order_line: + - company_id: base.main_company + delay: 7.0 + name: Table + price_unit: 1.0 + product_id: product_product_table0 + product_uom: product.product_uom_unit + product_uom_qty: 5.0 + product_uos_qty: 5.0 + state: draft + type: make_to_order + order_policy: manual + partner_id: base.res_partner_agrolait + partner_invoice_id: base.res_partner_address_8 + partner_order_id: base.res_partner_address_8 + partner_shipping_id: base.res_partner_address_8 + picking_policy: direct + pricelist_id: product.list0 + shop_id: sale.shop +- + I confirm the order. +- + !workflow {model: sale.order, action: order_confirm, ref: sale_order_so0} +- + I check that one procurement is generated. +- + !python {model: mrp.procurement}: | + from tools.translate import _ + proc_ids = self.search(cr, uid, [('state','=','confirmed')]) + assert proc_ids, _('No Procurements!') +- + The scheduler runs. +- + !function {model: mrp.procurement, name: run_scheduler}: + - model: mrp.procurement + search: "[('state','=','confirmed')]" +- + I check that the procurement for the product table is in exception state. + As my product's supply method is produce and mrp module is yet not installed. +- + !python {model: mrp.procurement}: | + from tools.translate import _ + proc_ids = self.search(cr, uid, [('state','=','exception')]) + assert proc_ids, _('No Procurements are in exception state!') + + + \ No newline at end of file