From 45b7c6fd1b9e7ea5cf2ce2cb11f6862fa4370a0a Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Wed, 5 Jan 2011 18:44:28 +0530 Subject: [PATCH] [IMP] YML improvement for mail_gateway, marketing_*,mrp_* bzr revid: ara@tinyerp.com-20110105131428-a2pll735vnxuulo6 --- addons/membership/test/test_membership.yml | 44 +++++++-------- addons/mrp/test/mrp_phantom_bom.yml | 54 +++++++++---------- addons/mrp/test/mrp_procurement.yml | 4 +- addons/mrp/test/mrp_production_order.yml | 10 ++-- addons/mrp_jit/test/mrp_jit.yml | 6 +-- addons/mrp_operations/test/mrp_operations.yml | 22 ++++---- addons/mrp_repair/test/test_mrp_repair.yml | 28 +++++----- addons/mrp_subproduct/test/mrp_subproduct.yml | 2 +- 8 files changed, 85 insertions(+), 85 deletions(-) diff --git a/addons/membership/test/test_membership.yml b/addons/membership/test/test_membership.yml index 63c0082a60f..195fbd15b01 100755 --- a/addons/membership/test/test_membership.yml +++ b/addons/membership/test/test_membership.yml @@ -1,22 +1,22 @@ -- | +- | In Order to test the Membership in OpenERP, which allows us to manage all operations for managing memberships. - | I'm creating "Golden Membership" which has Membership fee 80 EURO and It's started from 1st June to 31st Dec. -- +- !record {model: product.product, id: product_product_membershipproduct0}: categ_id: product.cat1 membership: 1 - membership_date_from: '2010-06-01' - membership_date_to: '2010-12-31' + membership_date_from: !eval datetime.today().strftime("%Y-%m-%d") + membership_date_to: !eval "'%s-%s-%s' %(datetime.now().year,datetime.now().month+6,datetime.now().day)" name: Golden Membership type: service list_price: 80.00 - + - | "Mark Johnson" want to join "Golden Membership". - | I'm creating new member "Mark Johnson". -- +- !record {model: res.partner, id: res_partner_markjohnson0}: address: - city: paris @@ -27,31 +27,31 @@ zip: '75016' name: Mark Johnson - | - I'm checking "Current Membership State" of "Mark Johnson". It is an "Non Member" or not. -- + I'm checking "Current Membership State" of "Mark Johnson". It is an "Non Member" or not. +- !assert {model: res.partner, id: res_partner_markjohnson0}: - membership_state == 'none', 'Member should be has "Current Membership State" in "Non Member".' - | I'm doing to make membership invoice for "Mark Johnson" on joining "Golden Membership". -- +- !python {model: res.partner}: | self.create_membership_invoice(cr, uid, [ref("res_partner_markjohnson0")], product_id=ref("product_product_membershipproduct0"), datas={"amount":80.00}) - | - I'm checking "Current Membership State" of "Mark Johnson". It is an "Waiting Member" or not. -- + I'm checking "Current Membership State" of "Mark Johnson". It is an "Waiting Member" or not. +- !assert {model: res.partner, id: res_partner_markjohnson0}: - membership_state == 'waiting', 'Member should be has "Current Membership State" in "Waiting Member".' - | I'm Opening that Invoice which is created for "Mark Johnson". - !python {model: res.partner}: | - import netsvc + import netsvc from tools.translate import _ invoice_pool = self.pool.get('account.invoice') partner_pool = self.pool.get('res.partner') membership_line_pool = self.pool.get('membership.membership_line') membership_pool = self.pool.get('product.product') - + membership_line_ids = membership_line_pool.search(cr, uid, [('membership_id','=',ref('product_product_membershipproduct0')),('partner','=',ref('res_partner_markjohnson0'))]) membership_lines = membership_line_pool.browse(cr, uid, membership_line_ids) assert membership_lines, _('Membership is not registrated.') @@ -63,7 +63,7 @@ - !assert {model: res.partner, id: res_partner_markjohnson0}: - membership_state == 'invoiced', 'Member should be has "Current Membership State" in "Invoiced Member".' - + - | I'm creating free member "Ms. Johnson" of "Golden Membership". - @@ -80,19 +80,19 @@ - | I'm checking "Current membership state" of "Ms. Johnson". It is an "Free Member" or not. -- +- !assert {model: res.partner, id: res_partner_msjohnson0}: - membership_state == 'free', 'Member should be has "Current Membership State" in "Free Member".' - | I'm set "Mark Johnson" as a associated member of "Ms. Johnson" and also set Non free member. -- +- !python {model: res.partner}: | self.write(cr, uid, [ref("res_partner_msjohnson0")], {'free_member': False, 'associate_member': ref("res_partner_markjohnson0")}) - | I'm checking "Current membership state" of "Ms. Johnson". It is an "Paid Member" or not. -- +- !assert {model: res.partner, id: res_partner_msjohnson0}: - membership_state == 'paid', 'Member should be has "Current Membership State" in "Paid Member".' @@ -102,8 +102,8 @@ !record {model: product.product, id: product_product_membershipproduct1}: categ_id: product.cat1 membership: 1 - membership_date_from: '2010-06-01' - membership_date_to: '2010-12-31' + membership_date_from: !eval datetime.today().strftime("%Y-%m-%d") + membership_date_to: !eval "'%s-%s-%s' %(datetime.now().year,datetime.now().month+6,datetime.now().day)" name: Silver Membership type: service list_price: 50.00 @@ -127,16 +127,16 @@ membership_line_pool = self.pool.get('membership.membership_line') membership_pool = self.pool.get('product.product') invoice_refund_pool = self.pool.get('account.invoice.refund') - + membership_line_ids = membership_line_pool.search(cr, uid, [('membership_id','=',ref('product_product_membershipproduct0')),('partner','=',ref('res_partner_markjohnson0'))]) membership_lines = membership_line_pool.browse(cr, uid, membership_line_ids) assert membership_lines, _('Membership is not registrated.') membership_line = membership_lines[0] refund_id = invoice_refund_pool.create(cr, uid, {'description': 'Refund of Membership', 'filter_refund': 'refund'}, {'active_id': membership_line.account_invoice_id.id}) - invoice_refund_pool.invoice_refund(cr, uid, [refund_id], {'active_id': membership_line.account_invoice_id.id, 'active_ids': [membership_line.account_invoice_id.id]}) + invoice_refund_pool.invoice_refund(cr, uid, [refund_id], {'active_id': membership_line.account_invoice_id.id, 'active_ids': [membership_line.account_invoice_id.id]}) - | I'm checking "Current membership state" of "Mark Johnson". It is an "Cancelled Member" or not. - !assert {model: res.partner, id: res_partner_markjohnson0}: - membership_state == 'canceled', 'Member should be has "Current Membership State" in "Cancelled Member".' - + diff --git a/addons/mrp/test/mrp_phantom_bom.yml b/addons/mrp/test/mrp_phantom_bom.yml index 6aa0d7cb17a..ac7e78637a4 100755 --- a/addons/mrp/test/mrp_phantom_bom.yml +++ b/addons/mrp/test/mrp_phantom_bom.yml @@ -1,5 +1,5 @@ - - In order to test the mrp phantom bom type in OpenERP, I will create products + In order to test the mrp phantom bom type in OpenERP, I will create products and then I will create Phantom bom structure for those products. - I create the products required to produce some orange juices with Oranges, Sugar and Water. @@ -8,10 +8,10 @@ category_id: product.product_uom_categ_kgm factor: 1.0 name: Litre - rounding: 0.01 + rounding: 0.01 - I create record for product Orange Juice. -- +- !record {model: product.product, id: product_product_orangejuice0}: categ_id: product.cat1 name: Orange Juice @@ -25,7 +25,7 @@ property_stock_production: stock.location_production - I create record for product Orange. -- +- !record {model: product.product, id: product_product_orange0}: categ_id: product.cat1 name: Orange @@ -44,7 +44,7 @@ property_stock_production: stock.location_production - I create record for product Sugar. -- +- !record {model: product.product, id: product_product_sugar0}: categ_id: product.cat1 name: Sugar @@ -63,7 +63,7 @@ property_stock_production: stock.location_production - I create record for product Water. -- +- !record {model: product.product, id: product_product_water0}: categ_id: product.cat1 name: Water @@ -82,7 +82,7 @@ property_stock_production: stock.location_production - I define the BoM to produce an orange juice. -- +- !record {model: mrp.bom, id: mrp_bom_orangejuice0}: company_id: base.main_company name: Orange Juice @@ -93,7 +93,7 @@ type: phantom - I create bom lines for BoM for Orange Juice. -- +- !record {model: mrp.bom, id: mrp_bom_orangejuice0}: bom_lines: - bom_id: mrp_bom_orangejuice0 @@ -122,7 +122,7 @@ type: normal - I define Minimum stock rules for my stockable product "Orange". -- +- !record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op0}: company_id: base.main_company location_id: stock.stock_location_stock @@ -136,7 +136,7 @@ warehouse_id: stock.warehouse0 - I define Minimum stock rules for my stockable product "Sugar". -- +- !record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op1}: company_id: base.main_company location_id: stock.stock_location_stock @@ -149,27 +149,27 @@ qty_multiple: 1 warehouse_id: stock.warehouse0 - - I want to produce 100 litres of Orange juice. I am creating a manufacturing order for this. - I want to see how much quantities of sub products I need, to produce the Orange juice. + I want to produce 100 litres of Orange juice. I am creating a manufacturing order for this. + I want to see how much quantities of sub products I need, to produce the Orange juice. - - I compute the data. I get the bill of material of Orange juice and list of + I compute the data. I get the bill of material of Orange juice and list of scheduled products according to my bom. -- +- !record {model: mrp.production, id: mrp_production_mo0}: company_id: base.main_company - date_planned: '2010-04-16 15:53:36' + date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") location_dest_id: stock.stock_location_output location_src_id: stock.stock_location_stock product_id: product_product_orangejuice0 product_qty: 100.0 product_uom: product_uom_litre0 -- +- Creating an mrp.production record. Computing Bills of materials. -- +- !record {model: mrp.production, id: mrp_production_mo0}: bom_id: mrp.mrp_bom_orangejuice0 company_id: base.main_company - date_planned: '2010-04-16 15:53:36' + date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") location_dest_id: stock.stock_location_output location_src_id: stock.stock_location_stock name: MO/00002 @@ -194,7 +194,7 @@ product_uom: mrp.product_uom_litre0 - I confirm the order. -- +- !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo0} - I am checking Procurement orders. There are 3 orders generated for Oranges, Sugar and Water. @@ -210,7 +210,7 @@ - model: procurement.order search: "[]" - - I am checking Internal picking. I see one picking for Orange juice and its + I am checking Internal picking. I see one picking for Orange juice and its stock moves for Oranges, Sugar and Water made correctly. - !python {model: stock.picking}: | @@ -218,7 +218,7 @@ pick_ids = self.search(cr, uid, [('type','=','internal')]) assert pick_ids, _('No Internal Pickings!') - - According to minimum stock rules. I have 2 purchase orders for + According to minimum stock rules. I have 2 purchase orders for Sugar with 6 Kg from Axelor and Orange 60 Kg from ASUStek. - I confirm the purchase order of Sugar and Orange. @@ -244,7 +244,7 @@ I create record for the incoming picking wizard. - !record {model: stock.partial.picking, id: stock_partial_picking0}: - date: '2010-04-30 16:53:36' + date: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - I make my pickings done. - @@ -253,7 +253,7 @@ picking_ids = pick_obj.search(cr, uid, [('type','=','in'),('state','=','assigned')]) partial = self.browse(cr, uid, 1, context) partial_datas = { - 'delivery_date': partial.date + 'delivery_date': partial.date } for pick in pick_obj.browse(cr, uid, picking_ids): for m in pick.move_lines: @@ -262,8 +262,8 @@ 'product_qty': m.product_qty, 'product_uom': m.product_uom.id } - if (pick.type == 'in') and (m.product_id.cost_method == 'average'): - partial_datas['move%s'%(m.id)].update({ + if (pick.type == 'in') and (m.product_id.cost_method == 'average'): + partial_datas['move%s'%(m.id)].update({ 'product_price': m.product_price, 'product_currency': m.product_currency }) @@ -292,5 +292,5 @@ I start the production order. - !workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0} - - + + diff --git a/addons/mrp/test/mrp_procurement.yml b/addons/mrp/test/mrp_procurement.yml index 47085904c35..568a5f0b0e8 100755 --- a/addons/mrp/test/mrp_procurement.yml +++ b/addons/mrp/test/mrp_procurement.yml @@ -202,7 +202,7 @@ I create record for partial picking. - !record {model: stock.partial.picking, id: stock_partial_picking0}: - date: '2010-04-30 16:53:36' + date: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - I make my picking done. @@ -238,7 +238,7 @@ I create record for partial picking. - !record {model: stock.partial.picking, id: stock_partial_picking0}: - date: '2010-04-30 16:53:36' + date: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - I make my picking done. diff --git a/addons/mrp/test/mrp_production_order.yml b/addons/mrp/test/mrp_production_order.yml index c32665f7258..6c1a2a4403e 100755 --- a/addons/mrp/test/mrp_production_order.yml +++ b/addons/mrp/test/mrp_production_order.yml @@ -1,13 +1,13 @@ - In order to test the manufacturing order working with procurements I will use - some products with different supply method and procurement method, also check + some products with different supply method and procurement method, also check the bills of material for the products. - I am creating one manufacturing order. -- +- !record {model: mrp.production, id: mrp_production_mo1}: company_id: base.main_company - date_planned: '2010-05-06 14:55:52' + date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") location_dest_id: stock.stock_location_stock location_src_id: stock.stock_location_stock product_id: product.product_product_pc1 @@ -24,10 +24,10 @@ }) - I confirm the order. -- +- !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo1} - - I am checking Procurement orders for components of PC1. + I am checking Procurement orders for components of PC1. - !python {model: procurement.order}: | from tools.translate import _ diff --git a/addons/mrp_jit/test/mrp_jit.yml b/addons/mrp_jit/test/mrp_jit.yml index 9d811d8b3e6..922dc3611bd 100755 --- a/addons/mrp_jit/test/mrp_jit.yml +++ b/addons/mrp_jit/test/mrp_jit.yml @@ -4,17 +4,17 @@ - !record {model: procurement.order, id: mrp_production_mo0}: company_id: base.main_company - date_planned: '2010-08-05 17:59:49' + date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") location_id: stock.stock_location_stock name: PROC/TEST/0001 product_id: product.product_product_pc2 product_qty: 10.0 product_uom: product.product_uom_unit product_uos_qty: 0.0 -- +- | I confirm the procurement order PROC/TEST/0001. -- +- !workflow {model: procurement.order, action: button_confirm, ref: mrp_production_mo0} - | diff --git a/addons/mrp_operations/test/mrp_operations.yml b/addons/mrp_operations/test/mrp_operations.yml index afa3fa55d74..4830da3a545 100755 --- a/addons/mrp_operations/test/mrp_operations.yml +++ b/addons/mrp_operations/test/mrp_operations.yml @@ -3,10 +3,10 @@ and check its effects on Work orders. - I create a production order. -- +- !record {model: mrp.production, id: mrp_production_mo0}: company_id: base.main_company - date_planned: '2010-05-25 11:17:34' + date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") location_dest_id: stock.stock_location_stock location_src_id: stock.stock_location_stock name: MO/00002 @@ -71,13 +71,13 @@ prod_order_ids = self.search(cr, uid, [('state','=','ready')]) for po in prod_order_ids: wf_service.trg_validate(uid, 'mrp.production', po, 'button_produce', cr) -- +- I am creating a mrp.product.produce record - !record {model: mrp.product.produce, id: mrp_product_produce_0}: mode: consume_produce product_qty: 5.0 -- +- I produce the product CPU_GEN. - !python {model: mrp.product.produce}: | @@ -106,17 +106,17 @@ I check that both internal pickings are done. - !python {model: stock.picking}: | - from tools.translate import _ + from tools.translate import _ pick_ids = self.search(cr, uid, [('state','=','done'),('type','=','internal')]) assert pick_ids, _('Internal pickings are not done!') - Now I start my first production order. - - !workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0} + !workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0} - - I check that the related work order is in progress state. + I check that the related work order is in progress state. - - !python {model: mrp.production.workcenter.line}: | + !python {model: mrp.production.workcenter.line}: | from tools.translate import _ order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','startworking')]) assert order_id, _('Work order not started yet!') @@ -126,7 +126,7 @@ !record {model: mrp.product.produce, id: mrp_product_produce_0}: mode: consume_produce product_qty: 5.0 -- +- I produce the product PC1. - !python {model: mrp.product.produce}: | @@ -138,7 +138,7 @@ - I check the related work order is done. - - !python {model: mrp.production.workcenter.line}: | + !python {model: mrp.production.workcenter.line}: | from tools.translate import _ order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','done')]) - assert order_id, _('Work order not done yet!') + assert order_id, _('Work order not done yet!') diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml index 3d9e85aa3ac..881ef449405 100755 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ b/addons/mrp_repair/test/test_mrp_repair.yml @@ -3,11 +3,11 @@ - | Given that I have already stock move line created. -- +- !record {model: stock.move, id: stock_move_pcbasicpc0}: company_id: base.main_company - date: '2010-06-24 20:10:28' - date_expected: '2010-06-24 20:10:55' + date: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") + date_expected: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") location_dest_id: stock.stock_location_stock location_id: stock.stock_location_stock name: '[PC1] Basic PC' @@ -15,13 +15,13 @@ product_qty: 1.0 product_uom: product.product_uom_unit product_uos_qty: 1.0 - + - | I start by creating new Repair order for "Basic Pc" product. -- +- !record {model: mrp.repair, id: mrp_repair_rma0}: address_id: base.res_partner_address_1 - guarantee_limit: '2010-06-24' + guarantee_limit: !eval datetime.today().strftime("%Y-%m-%d") invoice_method: 'after_repair' partner_invoice_id: base.res_partner_address_1 location_dest_id: stock.stock_location_14 @@ -41,23 +41,23 @@ type: add partner_id: base.res_partner_9 product_id: product.product_product_pc1 - + - | I check that Repair order is in "Draft" state. -- +- !assert {model: mrp.repair, id: mrp_repair_rma0}: - state == 'draft' - | I confirm This Repair order. -- - !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma0} +- + !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma0} - | I start the repairing process by click on "Start Repair" Button. - !workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rma0} - + - | I check that state is "Under Repair". - @@ -70,12 +70,12 @@ - | I select invoiced after repair option in this "RMA00004" Repair order. so I create Invoice by click on "Make Invoice" wizard. -- +- !record {model: mrp.repair.make_invoice, id: mrp_repair_make_invoice_0}: group: 1 - | I click on "Create Invoice" button of this wizard to make invoice. -- +- !python {model: mrp.repair.make_invoice}: | self.make_invoices(cr, uid, [ref("mrp_repair_make_invoice_0")], {"active_ids": [ref("mrp_repair.mrp_repair_rma0")]}) - | @@ -87,5 +87,5 @@ repair_id = self.browse(cr, uid, [ref('mrp_repair_rma0')], context=context)[0] invoice_ids = inv_obj.search(cr, uid, [('partner_id', '=', repair_id.partner_id.id)]) invoice_id = inv_obj.browse(cr, uid, invoice_ids)[0] - + assert repair_id.partner_id.id == invoice_id.partner_id.id, "No invoice existing for the same partner" diff --git a/addons/mrp_subproduct/test/mrp_subproduct.yml b/addons/mrp_subproduct/test/mrp_subproduct.yml index 56c62b94d09..43bb6e7247e 100755 --- a/addons/mrp_subproduct/test/mrp_subproduct.yml +++ b/addons/mrp_subproduct/test/mrp_subproduct.yml @@ -107,7 +107,7 @@ !record {model: mrp.production, id: mrp_production_mo0}: bom_id: mrp_bom_woodenchair0 company_id: base.main_company - date_planned: '2010-08-06 14:55:52' + date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") location_dest_id: stock.stock_location_stock location_src_id: stock.stock_location_stock name: MO/00004