odoo/addons/crm/test/test_crm_opportunity.yml

114 lines
4.1 KiB
YAML

- |
I start by creating a new Opportunity. And I select partner for opportunity.
I can see that after selecting partner his contact and email is automatically filled.
-
!record {model: crm.lead, id: crm_opportunity_abcfuelcounits0}:
email_from: info@balmerinc.be
name: 'ABC FUEL CO 829264 - 10002 units'
partner_address_id: base.res_partner_address_1
partner_id: base.res_partner_9
probability: 1.0
stage_id: crm.stage_lead1
categ_id: crm.categ_oppor2
section_id: crm.section_sales_department
- |
I check that the opportunity is in 'New' state.
-
!assert {model: crm.lead, id: crm_opportunity_abcfuelcounits0}:
- state == "draft"
- |
I check that phonecall record is created for that opportunity.
-
!python {model: crm.phonecall}: |
phone_obj = self.pool.get('crm.phonecall')
- |
I schedule Meeting on this current opportunity by clicking on "schedule
Meeting".
-
!python {model: crm.lead}: |
self.action_makeMeeting(cr, uid, [ref("crm_opportunity_abcfuelcounits0")])
- |
I can see that Meeting's calendar view is shown.
then I click on the date on which I want to schedule meeting.
I fill proper data for that meeting and save it.
-
!record {model: crm.meeting, id: crm_meeting_abcfuelcounits0}:
date: !eval time.strftime('%Y-%m-%d 00:00:00')
date_deadline: !eval time.strftime('%Y-%m-%d 08:00:00')
duration: 8.0
email_from: info@balmerinc.be
name: 'ABC FUEL CO 829264 - 10002 units'
opportunity_id: 'crm_opportunity_abcfuelcounits0'
partner_address_id: base.res_partner_address_1
partner_id: base.res_partner_9
section_id: crm.section_sales_department
state: open
- |
In order to schedule a phonecall to the partner
I click on "schedule call" button and select planned date for the call.
-
!record {model: crm.opportunity2phonecall, id: crm_opportunity2phonecall_abcfuelcounits0}:
date: !eval "(datetime.now() + timedelta(1)).strftime('%Y-%m-%d 11:15:00')"
name: 'ABC FUEL CO 829264 - 10002 units'
section_id: crm.section_sales_department
user_id: base.user_demo
categ_id: crm.categ_phone1
- |
schedule phonecall by opportunity2phoncall wizard.
-
!python {model: crm.opportunity2phonecall}: |
self.action_apply(cr, uid, [ref('crm_opportunity2phonecall_abcfuelcounits0')], {'active_ids': [ref("crm_opportunity_abcfuelcounits0")]})
- |
I check that phonecall record is created for that opportunity.
-
!python {model: crm.phonecall}: |
phone_obj = self.pool.get('crm.phonecall')
ids = phone_obj.search(cr, uid, [('name', '=', 'ABC FUEL CO 829264 - 10002 units')])
assert len(ids)
- |
I can see phonecall record after click on "Schedule call" wizard.
-
!record {model: crm.phonecall, id: crm_phonecall_abcfuelcounits0}:
date: !eval "(datetime.now() + timedelta(1)).strftime('%Y-%m-%d 11:15:00')"
duration: 3.0
name: 'ABC FUEL CO 829264 - 10002 units'
partner_address_id: base.res_partner_address_1
partner_id: base.res_partner_9
section_id: crm.section_sales_department
- |
I Merge the opportunities.
-
for that create two opportunities first opportunity 'Test FUEL CO'.
-
!record {model: crm.lead, id: crm_opportunity_1}:
email_from: info@balmerinc.be
name: 'Test FUEL CO 829264 - 10002 units'
partner_address_id: base.res_partner_address_1
partner_id: base.res_partner_9
probability: 1.0
stage_id: crm.stage_lead1
categ_id: crm.categ_oppor2
section_id: crm.section_sales_department
-
I create the opportunity 'FUEL CO'.
-
!record {model: crm.lead, id: crm_opportunity_2}:
email_from: info@balmerinc.be
name: 'FUEL CO 829264 - 10002 units'
partner_address_id: base.res_partner_address_1
partner_id: base.res_partner_9
probability: 1.0
stage_id: crm.stage_lead1
categ_id: crm.categ_oppor2
section_id: crm.section_sales_department
- |
I Merge two Opportunities.
-
!python {model: crm.merge.opportunity}: |
op_list = [ref('crm_opportunity_1'),ref('crm_opportunity_2')]
op_ids=self.pool.get('crm.lead').browse(cr,uid,op_list)
lead_ids = [ref('crm_lead_newcustomer0')]
self.merge(cr, uid, op_ids, {'lead_ids': lead_ids})