[IMP] sale order line invisible type
[odoo/odoo.git] / addons / crm / test / process / communication_with_customer.yml
1 -
2   Customer interested in our product. so he send request by email to get more details.
3 -
4   Mail script will be fetched him request from mail server. so I process that mail after read EML file 
5 -
6   !python {model: mail.thread}: |
7     import addons
8     request_file = open(addons.get_module_resource('crm','test', 'customer_request.eml'),'rb')
9     request_message = request_file.read()
10     self.message_process(cr, uid, 'crm.lead', request_message)
11 -
12   After getting the mail, I check details of new lead of that customer.
13 -
14   !python {model: crm.lead}: |
15     lead_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')])
16     assert lead_ids and len(lead_ids), "Lead is not created after getting request"
17     lead = self.browse(cr, uid, lead_ids[0], context=context)
18     assert not lead.partner_id, "Customer should be a new"
19     assert lead.name == "Fournir votre devis avec le meilleur prix.", "Subject does not match"
20 -
21   I reply him request with welcome message.
22 -
23   !python {model: mail.compose.message}: |
24     lead_ids = self.pool.get('crm.lead').search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')])
25     context.update({'active_model': 'crm.lead','active_id': lead_ids[0]})
26     id = self.create(cr, uid, {'body_text': "Merci à l'intérêt pour notre produit.nous vous contacterons bientôt. Merci", 'email_from': 'sales@mycompany.com'}, context=context)
27     try:
28         self.send_mail(cr, uid, [id], context=context)
29     except:
30         pass
31 -
32   Now, I convert him into customer and put into regular customer list.
33 -
34   !python {model: crm.lead}: |
35     lead_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')])
36     self.convert_partner(cr, uid, lead_ids, context=context)
37 -
38   Now, I search customer in regular customer list.
39 -
40   !python {model: crm.lead}: |
41     partner_ids = self.message_partner_by_email(cr, uid, 'Mr. John Right <info@customer.com>')
42     assert partner_ids.get('partner_id'), "Customer is not found in regular customer list."
43 -
44   I convert one phonecall request as a customer and put into regular customer list. 
45 -
46   !python {model: crm.phonecall2partner}: |
47     context.update({'active_model': 'crm.phonecall', 'active_ids': [ref("crm.crm_phonecall_4")], 'active_id': ref("crm.crm_phonecall_4")})
48     new_id = self.create(cr, uid, {}, context=context)
49     self.make_partner(cr, uid, [new_id],  context=context)
50 -
51   I check converted phonecall to partner.
52 -
53   !python {model: res.partner}: |
54     partner_id = self.search(cr, uid, [('phonecall_ids', '=', ref('crm.crm_phonecall_4'))])
55     assert partner_id, "Customer is not found in regular customer list."
56     data = self.browse(cr, uid, partner_id, context=context)[0]
57     assert data.user_id.id == ref("base.user_root"), "User not assign properly"
58     assert data.name == "Wanted information about pricing of Laptops", "Bad partner name"