3d4542dc7b107ca897e50352f418458647bee546
[odoo/odoo.git] / addons / sale_crm / test / sale_crm.yml
1 -
2   In order to test the sale_crm module in the Open-ERP,
3   I create an opportunity and create a sale order through 'Convert to Sale' wizard .
4 -
5   I create an opportunity
6 -
7   !record {model: crm.lead, id: crm_lead_opportunity0}:
8     country_id: base.be
9     name: Opportunity-1
10     planned_revenue: 50000.0
11     probability: 70.0
12     partner_address_id: base.res_partner_address_7
13     partner_id: base.res_partner_4
14     planned_revenue: 0.0
15     probability: 0.0
16     section_id: crm.section_sales_department
17     type: opportunity
18     categ_id: crm.categ_oppor1
19 -
20   Then I click on the 'Convert to Sale' wizard
21 -
22   I place a sale order for product keyboard having quantity 50
23 -
24   !record {model: crm.make.sale, id: crm_make_sale_0}:
25     partner_id: base.res_partner_4
26     sale_order_line:
27       - name: '[KEYA] Keyboard - AZERTY'
28         price_unit: 7.0
29         product_uom: product.product_uom_unit
30         product_uom_qty: 50.0
31         delay: 7.0
32         product_id: product.product_product_24
33         type: make_to_stock
34     shop_id: sale.shop
35 -
36   Then I click on the 'Ok' button of wizard
37 -
38   !python {model: crm.make.sale}: |
39     self.makeOrder(cr, uid, [ref("crm_make_sale_0")], {"lang": "en_US", "tz": False,
40       "active_model": "crm.lead", "section_id": False, "default_type": "opportunity",
41       "search_default_user_id": 1, "search_default_current": 1, "active_ids": [1],
42       "active_id": (1)})
43 -
44   I verify that a sale order has been generated from an opportunity
45 -
46   !python {model: sale.order}: |
47     crm_obj = self.pool.get('crm.lead')
48     crm = self.browse(cr, uid, ref("crm_lead_opportunity0"))
49     so = self.search(cr, uid, [('origin','=', 'Opportunity: %s' % str(crm.id))])
50     assert so, "Sale order has not been created "