205 lines
7.0 KiB
YAML
205 lines
7.0 KiB
YAML
- |
|
|
In order to test the CRM in OpenERP,
|
|
I will do a customer qualification process that
|
|
starts with a fist contact with a customer (a lead), which will be converted to a
|
|
business opportunity and a partner.
|
|
-
|
|
I check installer report.
|
|
-
|
|
!record {model: base.setup.installer , id: base_action_rule_0_1}:
|
|
name: Test_action
|
|
-
|
|
I create the view at the time of setup.
|
|
-
|
|
!python {model: base.setup.installer}: |
|
|
self.fields_view_get(cr, uid,view_id=None, view_type='form', context=None, toolbar=False, submenu=False)
|
|
- |
|
|
In order to test the flow, I create a two new users "user_crm" and
|
|
I assign the group "salesman".
|
|
-
|
|
!record {model: res.users, id: res_users_usercrm0}:
|
|
company_id: base.main_company
|
|
context_lang: en_US
|
|
context_section_id: crm.section_sales_department
|
|
groups_id:
|
|
- base.group_sale_salesman
|
|
login: user_crm
|
|
name: user_crm
|
|
password: user_crm
|
|
|
|
- |
|
|
I start by creating a new lead "New Customer" and I provide an address to this
|
|
new customer, as well as an email "info@mycustomer.com".
|
|
-
|
|
!record {model: crm.lead, id: crm_lead_newcustomer0}:
|
|
email_from: info@mycustomer.com
|
|
name: New Customer
|
|
partner_name: Capegemini
|
|
partner_id: base.res_partner_9
|
|
phone: (855) 924-4364
|
|
mobile: (333) 715-1450
|
|
section_id: crm.section_sales_department
|
|
referred: False
|
|
- |
|
|
I check that the lead is in 'draft' state.
|
|
-
|
|
!assert {model: crm.lead, id: crm_lead_newcustomer0, string: Lead in Draft}:
|
|
- state == "draft"
|
|
-
|
|
I open lead by click on "Open" button.
|
|
-
|
|
!python {model: crm.lead}: |
|
|
self.case_open(cr, uid, [ref("crm_lead_newcustomer0")])
|
|
fields={
|
|
'day_open': 0.0,
|
|
'day_close': 0.0
|
|
}
|
|
self._compute_day(cr, uid, [ref("crm_lead_newcustomer0")], fields, context)
|
|
- |
|
|
I check that lead is now in 'open' state.
|
|
-
|
|
!assert {model: crm.lead, id: crm_lead_newcustomer0, string: Lead in open state}:
|
|
- state == "open"
|
|
-
|
|
Now, Find id for case object.
|
|
-
|
|
!python {model: crm.case.categ}: |
|
|
self._find_object_id(cr, uid, context)
|
|
- |
|
|
As the lead seems to be a real business opportunity, I will convert it to a
|
|
partner
|
|
and a business opportunity by clicking on the "Convert" button.
|
|
-
|
|
!python {model: crm.lead}: |
|
|
lead = self.browse(cr, uid, ref('crm_lead_newcustomer0'))
|
|
action = self.convert_opportunity(cr, uid, [ref("crm_lead_newcustomer0")], {'active_ids': [ref("crm_lead_newcustomer0")]})
|
|
assert action['res_model'] == 'crm.lead2opportunity.partner'
|
|
-
|
|
|
|
|
Now, select "create a new partner" option in this wizard.
|
|
-
|
|
!record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner_create_0}:
|
|
action: 'create'
|
|
name: 'convert'
|
|
-
|
|
Then, Click on "Create Opportunity" button of this wizard.
|
|
-
|
|
!python {model: crm.lead2opportunity.partner}: |
|
|
self.action_apply(cr, uid, [ref("crm_lead2opportunity_partner_create_0")], {'active_ids': [ref("crm_lead_newcustomer0")], 'active_id': ref("crm_lead_newcustomer0")})
|
|
-
|
|
|
|
|
Now, select "Link to an existing partner" option in this wizard.
|
|
-
|
|
!record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner_create_1}:
|
|
action: 'exist'
|
|
name: 'existing partner'
|
|
-
|
|
Then, Click on "Create Opportunity" button of this wizard.
|
|
-
|
|
!python {model: crm.lead2opportunity.partner}: |
|
|
self.action_apply(cr, uid, [ref("crm_lead2opportunity_partner_create_1")], {'active_ids': [ref("crm_lead_newcustomer0")], 'active_id': ref("crm_lead_newcustomer0")})
|
|
-
|
|
|
|
|
Now, select "Do not link to a partner" option in this wizard.
|
|
-
|
|
!record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner_create_2}:
|
|
action: 'nothing'
|
|
name: 'Do not link to a partner'
|
|
-
|
|
Then, Click on "Create Opportunity" button of this wizard.
|
|
-
|
|
!python {model: crm.lead2opportunity.partner}: |
|
|
self.action_apply(cr, uid, [ref("crm_lead2opportunity_partner_create_2")], {'active_ids': [ref("crm_lead_newcustomer0")], 'active_id': ref("crm_lead_newcustomer0")})
|
|
- |
|
|
In order to check the opportunity is created or not, I check type.
|
|
-
|
|
!python {model: crm.lead}: |
|
|
lead = self.browse(cr, uid, ref("crm_lead_newcustomer0"))
|
|
assert lead.type == 'opportunity'
|
|
|
|
-
|
|
I create mass report of lead to opprtunity partner.
|
|
-
|
|
!record {model: crm.lead2opportunity.partner.mass, id: crm_lead2opportunity_partner_mass0}:
|
|
user_ids:
|
|
- base.user_root
|
|
section_id: crm.section_sales_department
|
|
-
|
|
Then, execute that mass wizard.
|
|
-
|
|
!python {model: crm.lead2opportunity.partner.mass}: |
|
|
self.mass_convert(cr, uid, [ref("crm_lead2opportunity_partner_mass0")],{'active_ids': [ref("crm_lead_newcustomer0")], 'active_id': ref("crm_lead_newcustomer0")})
|
|
|
|
-
|
|
I create notes.
|
|
-
|
|
!record {model: crm.add.note, id: crm_add_note0}:
|
|
{}
|
|
-
|
|
Then, try to add notes.
|
|
-
|
|
!python {model: crm.add.note}: |
|
|
try:
|
|
context.update({'active_model': "crm.lead"})
|
|
model = ref("crm_lead_newcustomer0") or False
|
|
self.action_add(cr, uid, [ref("crm_add_note0")],context)
|
|
except:
|
|
pass
|
|
-
|
|
I create send mail report.
|
|
-
|
|
!record {model: crm.send.mail, id: crm_send_mail0}:
|
|
{}
|
|
-
|
|
I close lead by click on "close" button.
|
|
-
|
|
!python {model: crm.send.mail}: |
|
|
fields = {
|
|
'email_to': 'info@axelor.com',
|
|
'email_from': 'Administrator <admin@openerp.com>',
|
|
'subject': 'latest',
|
|
'body': 'test',
|
|
'reply_to': 'sales_openerp@openerp.com',
|
|
'state': 'draft'
|
|
}
|
|
self.default_get(cr, uid, fields, {'active_ids':[ref('crm_lead_newcustomer0')],'active_id':ref('crm_lead_newcustomer0'),'active_model':'crm.lead'})
|
|
#self.action_mass_send(cr, uid, [ref('crm_send_mail0')], {'active_ids':[ref('crm_send_mail0')],'active_id':ref('crm_send_mail0')})
|
|
self.get_reply_defaults(cr, uid, fields, {'active_ids':[ref('crm_send_mail0')],'active_id':ref('crm_send_mail0')})
|
|
-
|
|
I close lead by click on "close" button.
|
|
-
|
|
!python {model: crm.lead}: |
|
|
self.case_close(cr, uid, [ref("crm_lead_newcustomer0")])
|
|
- |
|
|
I check that lead is now in 'done' state.
|
|
-
|
|
!assert {model: crm.lead, id: crm_lead_newcustomer0, string: Lead in done state}:
|
|
- state == "done"
|
|
-
|
|
I cancel lead by click on "cancel" button.
|
|
-
|
|
!python {model: crm.lead}: |
|
|
self.case_cancel(cr, uid, [ref("crm_lead_newcustomer0")])
|
|
- |
|
|
I check that lead is now in 'cancel' state.
|
|
-
|
|
!assert {model: crm.lead, id: crm_lead_newcustomer0, string: Lead in cancel state}:
|
|
- state == "cancel"
|
|
|
|
#-
|
|
# |
|
|
# yaml is also not working with smtp server and send new email.
|
|
|
|
- |
|
|
I configure with smtp server.
|
|
- |
|
|
And I communicate with lead through send New mail to Lead using its email address from the user who is logged in.
|
|
- |
|
|
I check that communication history generated when send email to lead.
|
|
- |
|
|
Then, I add a cc which receive copy of future communication between partner and users by mail.
|
|
|
|
- |
|
|
I Reply to last Email to lead with some document attached.and check that communication history generated or not.
|
|
|