diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py
index 443a5eea648..21000f28720 100644
--- a/addons/crm/__openerp__.py
+++ b/addons/crm/__openerp__.py
@@ -107,10 +107,10 @@ Dashboard for CRM will include:
],
'test': [
'test/crm_lead_message.yml',
-# 'test/lead2opportunity2win.yml', # TODO: Need To Clean
-# 'test/lead2opportunity_assign_salesmen.yml', # TODO : Need To Clean
-# 'test/crm_lead_merge.yml', # TODO : Need To Clean
-# 'test/crm_lead_cancel.yml',# TODO: Need To Clean
+ 'test/lead2opportunity2win.yml',
+ 'test/lead2opportunity_assign_salesmen.yml',
+ 'test/crm_lead_merge.yml',
+# 'test/crm_lead_cancel.yml', # TODO : Need To Clean
'test/segmentation.yml',
'test/phonecalls.yml',
'test/crm_lead_onchange.yml',
diff --git a/addons/crm/crm_lead_demo.xml b/addons/crm/crm_lead_demo.xml
index b205cb14da2..0d6d35cacc8 100644
--- a/addons/crm/crm_lead_demo.xml
+++ b/addons/crm/crm_lead_demo.xml
@@ -313,7 +313,7 @@ Andrew
Meeting for pricing information.
-
+
diff --git a/addons/crm/test/crm_lead_merge.yml b/addons/crm/test/crm_lead_merge.yml
index b14f9272df9..99b354076eb 100644
--- a/addons/crm/test/crm_lead_merge.yml
+++ b/addons/crm/test/crm_lead_merge.yml
@@ -1,6 +1,13 @@
-
During a mixed merge (involving leads and opps), data should be handled a certain way following their type (m2o, m2m, text, ...) Start by creating two leads and an opp.
+-
+ !record {model: crm.lead, id: test_crm_opp_01}:
+ type: 'opportunity'
+ name: 'Test opportunity 1'
+ partner_id: base.res_partner_5
+ stage_id: stage_lead1
+ description: This is the description of the test opp 1.
-
!record {model: crm.lead, id: test_crm_lead_01}:
type: 'lead'
@@ -15,16 +22,9 @@
partner_id: base.res_partner_3
stage_id: stage_lead1
description: This is the description of the test lead 2.
--
- !record {model: crm.lead, id: test_crm_opp_01}:
- type: 'opportunity'
- name: 'Test opportunity 1'
- partner_id: base.res_partner_5
- stage_id: stage_lead1
- description: This is the description of the test opp 1.
-
!python {model: crm.lead}: |
- lead_ids = [ref('test_crm_lead_01'), ref('test_crm_lead_02'), ref('test_crm_opp_01')]
+ lead_ids = [ref('test_crm_opp_01'),ref('test_crm_lead_01'), ref('test_crm_lead_02')]
context.update({'active_model': 'crm.lead', 'active_ids': lead_ids, 'active_id': lead_ids[0]})
-
I create a merge wizard and merge the leads and opp together in the first item of the list.
@@ -122,4 +122,4 @@
assert merge_result.partner_id.id == ref("base.res_partner_5"), 'Partner mismatch'
assert merge_result.type == 'opportunity', 'Type mismatch: when opps get merged together, the result should be a new opp (instead of %s)' % merge_result.type
tailing_opp = self.search(cr, uid, [('id', '=', ref('test_crm_opp_03'))])
- assert not tailing_opp, 'This tailing opp (id %s) should not exist anymore' % ref('test_crm_opp_03')
\ No newline at end of file
+ assert not tailing_opp, 'This tailing opp (id %s) should not exist anymore' % ref('test_crm_opp_03')
diff --git a/addons/crm/test/lead2opportunity2win.yml b/addons/crm/test/lead2opportunity2win.yml
index 94e7149ef77..003848c6ee7 100644
--- a/addons/crm/test/lead2opportunity2win.yml
+++ b/addons/crm/test/lead2opportunity2win.yml
@@ -1,25 +1,25 @@
-
In order to test the conversion of a lead into a opportunity,
-
- I open a lead.
+ I set lead to open stage.
-
!python {model: crm.lead}: |
- self.case_open(cr, uid, [ref("crm_case_4")])
+ self.write(cr, uid, [ref("crm_case_3")],{'stage_id':ref("stage_lead1")})
-
- I check if the lead state is "Open".
+ I check if the lead stage is "Open".
-
- !assert {model: crm.lead, id: crm.crm_case_4, string: Lead state is Open}:
- - state == "open"
+ !assert {model: crm.lead, id: crm.crm_case_3, string: Lead stage is Open}:
+ - stage_id.sequence == 1
-
I convert lead into opportunity for exiting customer.
-
!python {model: crm.lead}: |
- self.convert_opportunity(cr, uid ,[ref("crm_case_4")], ref("base.res_partner_2"))
+ self.convert_opportunity(cr, uid ,[ref("crm_case_3")], ref("base.res_partner_2"))
-
I check details of converted opportunity.
-
!python {model: crm.lead}: |
- lead = self.browse(cr, uid, ref('crm_case_4'))
+ lead = self.browse(cr, uid, ref('crm_case_3'))
assert lead.type == 'opportunity', 'Lead is not converted to opportunity!'
assert lead.partner_id.id == ref("base.res_partner_2"), 'Partner mismatch!'
assert lead.stage_id.id == ref("stage_lead1"), 'Stage of opportunity is incorrect!'
@@ -28,7 +28,7 @@
-
!python {model: crm.opportunity2phonecall}: |
import time
- context.update({'active_model': 'crm.lead', 'active_ids': [ref('crm_case_4')]})
+ context.update({'active_model': 'crm.lead', 'active_ids': [ref('crm_case_3')]})
call_id = self.create(cr, uid, {'date': time.strftime('%Y-%m-%d %H:%M:%S'),
'name': "Bonjour M. Jean, Comment allez-vous? J'ai bien reçu votre demande, pourrions-nous en parler quelques minutes?"}, context=context)
self.action_schedule(cr, uid, [call_id], context=context)
@@ -36,46 +36,46 @@
I check that phonecall is scheduled for that opportunity.
-
!python {model: crm.phonecall}: |
- ids = self.search(cr, uid, [('opportunity_id', '=', ref('crm_case_4'))])
+ ids = self.search(cr, uid, [('opportunity_id', '=', ref('crm_case_3'))])
assert len(ids), 'Phonecall is not scheduled'
-
Now I schedule meeting with customer.
-
!python {model: crm.lead}: |
- self.action_makeMeeting(cr, uid, [ref('crm_case_4')])
+ self.action_makeMeeting(cr, uid, [ref('crm_case_3')])
-
After communicated with customer, I put some notes with contract details.
-
!python {model: crm.lead}: |
- self.message_post(cr, uid, [ref('crm_case_4')], subject='Test note', body='Détails envoyés par le client sur le FAX pour la qualité')
+ self.message_post(cr, uid, [ref('crm_case_3')], subject='Test note', body='Détails envoyés par le client sur le FAX pour la qualité')
-
I win this opportunity
-
!python {model: crm.lead}: |
- self.case_mark_won(cr, uid, [ref("crm_case_4")])
+ self.case_mark_won(cr, uid, [ref("crm_case_3")])
-
I check details of the opportunity after having won the opportunity.
-
!python {model: crm.lead}: |
- lead = self.browse(cr, uid, ref('crm_case_4'))
+ lead = self.browse(cr, uid, ref('crm_case_3'))
assert lead.stage_id.id == ref('crm.stage_lead6'), "Opportunity stage should be 'Won'."
- assert lead.state == 'done', "Opportunity is not in 'done' state!"
+ assert lead.stage_id.probability == 100.0, "Opportunity is not 'done'"
assert lead.probability == 100.0, "Revenue probability should be 100.0!"
-
I convert mass lead into opportunity customer.
-
!python {model: crm.lead2opportunity.partner.mass}: |
- context.update({'active_model': 'crm.lead', 'active_ids': [ref("crm_case_11"), ref("crm_case_2")], 'active_id': ref("crm_case_11")})
+ context.update({'active_model': 'crm.lead', 'active_ids': [ref("crm_case_13"), ref("crm_case_2")], 'active_id': ref("crm_case_13")})
id = self.create(cr, uid, {'user_ids': [(6, 0, [ref('base.user_root')])], 'section_id': ref('crm.section_sales_department')}, context=context)
self.mass_convert(cr, uid, [id], context=context)
-
Now I check first lead converted on opportunity.
-
!python {model: crm.lead}: |
- opp = self.browse(cr, uid, ref('crm_case_11'))
- assert opp.name == "Need estimated cost for new project", "Opportunity name not correct"
+ opp = self.browse(cr, uid, ref('crm_case_13'))
+ assert opp.name == "Plan to buy 60 keyboards and mouses", "Opportunity name not correct"
assert opp.type == 'opportunity', 'Lead is not converted to opportunity!'
- expected_partner = "Thomas Passot"
+ expected_partner = "Will McEncroe"
assert opp.partner_id.name == expected_partner, 'Partner mismatch! %s vs %s' % (opp.partner_id.name, expected_partner)
assert opp.stage_id.id == ref("stage_lead1"), 'Stage of probability is incorrect!'
-
@@ -96,8 +96,8 @@
-
!python {model: crm.lead}: |
lead = self.browse(cr, uid, ref('crm_case_2'))
- assert lead.stage_id.id == ref('crm.stage_lead8'), "Opportunity stage should be 'Lost'."
- assert lead.state == 'cancel', "Lost opportunity is not in 'cancel' state!"
+ assert lead.stage_id.id == ref('crm.stage_lead7'), "Opportunity stage should be 'Lost'."
+ assert lead.stage_id.sequence != 1 and lead.stage_id.probability == 0.0, "Lost opportunity is not in 'cancel' state!"
assert lead.probability == 0.0, "Revenue probability should be 0.0!"
-
I confirm review needs meeting.
diff --git a/addons/crm/test/lead2opportunity_assign_salesmen.yml b/addons/crm/test/lead2opportunity_assign_salesmen.yml
index 0edd3b8edce..bc3f2182d33 100644
--- a/addons/crm/test/lead2opportunity_assign_salesmen.yml
+++ b/addons/crm/test/lead2opportunity_assign_salesmen.yml
@@ -73,4 +73,4 @@
for opp in opps:
assert opp.type == 'opportunity', 'Type mismatch: this should be an opp, not a lead'
assert opp.user_id.id == salesmen_ids[i], 'Salesman mismatch: expected salesman %r, got %r' % (salesmen_ids[i], opp.user_id.id)
- i = i+1 if (i < len(salesmen_ids) - 1) else 0
\ No newline at end of file
+ i = i+1 if (i < len(salesmen_ids) - 1) else 0
diff --git a/addons/crm/wizard/crm_merge_opportunities.py b/addons/crm/wizard/crm_merge_opportunities.py
index 051a8dcf909..6229b775207 100644
--- a/addons/crm/wizard/crm_merge_opportunities.py
+++ b/addons/crm/wizard/crm_merge_opportunities.py
@@ -46,7 +46,6 @@ class crm_merge_opportunity(osv.osv_memory):
#TODO: why is this passed through the context ?
context['lead_ids'] = [opportunity2merge_ids[0].id]
-
merge_id = lead_obj.merge_opportunity(cr, uid, [x.id for x in opportunity2merge_ids], context=context)
# The newly created lead might be a lead or an opp: redirect toward the right view
diff --git a/addons/hr_recruitment/__openerp__.py b/addons/hr_recruitment/__openerp__.py
index cf821e6bcb7..33549558a4d 100644
--- a/addons/hr_recruitment/__openerp__.py
+++ b/addons/hr_recruitment/__openerp__.py
@@ -61,7 +61,7 @@ You can define the different phases of interviews and easily rate the applicant
],
'demo': ['hr_recruitment_demo.xml'],
'test': [
-# 'test/recruitment_process.yml' # TODO : Need To Clean
+ 'test/recruitment_process.yml'
],
'installable': True,
'auto_install': False,
diff --git a/addons/hr_recruitment/test/recruitment_process.yml b/addons/hr_recruitment/test/recruitment_process.yml
index 335edc71892..376bcd8a017 100644
--- a/addons/hr_recruitment/test/recruitment_process.yml
+++ b/addons/hr_recruitment/test/recruitment_process.yml
@@ -17,33 +17,8 @@
resume_ids = self.pool.get('ir.attachment').search(cr, uid, [('datas_fname','=','resume.pdf'),('res_model','=',self._name),('res_id','=',applicant.id)])
assert applicant.name == "Application for the post of Jr.application Programmer.", "Applicant name does not match."
assert applicant.stage_id.id == ref('hr_recruitment.stage_job1'), "Stage should be 'Initial qualification' and is '%s'." % (applicant.stage_id.name)
- assert applicant.state == "draft", "Applicant state should be 'draft'."
+ assert applicant.stage_id.sequence == 1, "Applicant stage sequence should be 1"
assert len(resume_ids), "Resume is not attached."
--
- I refuse the applicant (hr_case_programmer)
--
- !python {model: hr.applicant}: |
- self.case_cancel(cr, uid, [ref("hr_case_programmer")])
--
- I check the details of the refused applicant.
--
- !python {model: hr.applicant}: |
- applicant = self.browse(cr, uid, ref("hr_case_programmer"), context=context)
- assert applicant.stage_id.id == ref('hr_recruitment.stage_job6'), "Stage should be 'Refused' and is %s." % (applicant.stage_id.name)
- assert applicant.state == 'cancel', "Applicant is not in 'cancel' state."
--
- I reset and re-open the previously refused applicant.
--
- !python {model: hr.applicant}: |
- self.case_reset(cr, uid, [ref("hr_case_programmer")])
- self.case_open(cr, uid, [ref("hr_case_programmer")])
--
- I check the details of the re-opened applicant.
--
- !python {model: hr.applicant}: |
- applicant = self.browse(cr, uid, ref("hr_case_programmer"), context=context)
- assert applicant.stage_id.id == ref('hr_recruitment.stage_job2'), "Stage should be 'First interview' and is '%s'." % (applicant.stage_id.name)
- assert applicant.state == "open", "Applicant state should be 'open'."
-
I assign the Job position to the applicant
-
@@ -95,25 +70,12 @@
-
!python {model: hr.applicant}: |
self.case_close_with_emp(cr, uid, [ref('hr_case_programmer')])
--
- I check that applicant is "Hired".
--
- !assert {model: hr.applicant, id: hr_case_programmer, string: Applicant state is done}:
- - state == 'done'
--
- I do not give employment to the hired the applicant.
--
- !python {model: hired.employee}: |
- context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")})
- emp_id = self.create(cr, uid, {}, context=context)
- self.case_close(cr, uid, [emp_id], context=context)
-
Now I give employment to hired applicant .
-
!python {model: hr.applicant}: |
hired_emp_obj = self.pool.get('hired.employee')
- self.case_reset(cr, uid, [ref("hr_case_programmer")])
- self.case_open(cr, uid, [ref("hr_case_programmer")])
+ self.write(cr, uid, [ref("hr_case_programmer")],{'stage_id':ref("stage_job1")})
context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")})
emp_hr_id = hired_emp_obj.create(cr, uid, {}, context=context)
hired_emp_obj.case_close_with_emp(cr, uid, [emp_hr_id], context=context)
diff --git a/addons/project/project.py b/addons/project/project.py
index aba3daa41c7..24fe21c7e0c 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -391,7 +391,6 @@ class project(osv.osv):
'date':new_date_end,
'parent_id':parent_id}, context=context)
result.append(new_id)
-
child_ids = self.search(cr, uid, [('parent_id','=', proj.analytic_account_id.id)], context=context)
parent_id = self.read(cr, uid, new_id, ['analytic_account_id'])['analytic_account_id'][0]
if child_ids:
diff --git a/addons/project/test/task_process.yml b/addons/project/test/task_process.yml
index e37b2116714..89e6b0fc330 100644
--- a/addons/project/test/task_process.yml
+++ b/addons/project/test/task_process.yml
@@ -1,14 +1,11 @@
-
- I put task in pending due to specification is not clear.
+ I open task.
+ !python {model : project.task}: |
+ self.write(cr, uid, [ref("project_task_1")], {'stage_id':ref(project_tt_analysis)}
-
- !python {model: project.task}: |
- self.do_pending(cr, uid, [ref("project_task_1")])
- context.update({"active_id": ref("project_task_1")})
--
- I check state of task after put in pending.
--
- !assert {model: project.task, id: project_task_1, severity: error, string: task should be in pending state}:
- - state == "pending"
+ I chek task is open.
+ !assert {model: project.task , id: project_task_1, string: Task is Open}:
+ - stage_id.sequence == 1
-
!record {model: project.task.delegate, id: delegate_id}:
user_id: base.user_demo
@@ -25,52 +22,3 @@
!python {model: project.task}: |
task = self.browse(cr, uid, ref("project_task_1"), context=context)
assert task.planned_hours == 2.0, "Planning hours is not correct after delegated."
- assert task.state == "pending", "Task should be in Pending after delegated."
--
- I re-open the task.
--
- !python {model: project.task}: |
- self.do_reopen(cr, uid, [ref("project_task_1")])
--
- I check reopened task details.
--
- !assert {model: project.task, id: project_task_1, severity: error, string: task should be open.}:
- - state == "open"
--
- I change the stage of task to next stage.
--
- !python {model: project.task}: |
- self.stage_next(cr, uid, [ref("project_task_1")])
--
- !record {model: project.task.reevaluate, id: reevaluate_id}:
- remaining_hours : 120
--
- I reevaluate task with remaining hours.
--
- !python {model: project.task.reevaluate}: |
- self.compute_hours(cr, uid, [ref("reevaluate_id")], {"active_id": ref("project_task_1")})
--
- I check remaining hours after reevaluated task.
--
- !assert {model: project.task, id: project_task_1, severity: error, string: task should be reevaluated}:
- - remaining_hours == 120.0
--
- I close the task.
--
- !python {model: project.task}: |
- self.action_close(cr, uid, [ref("project_task_1")])
--
- I check state after closed.
--
- !assert {model: project.task, id: project_task_1, severity: error, string: task is in open state}:
- - state == "done"
--
- I change the stage of task to previous stage.
--
- !python {model: project.task}: |
- self.stage_previous(cr, uid, [ref("project_task_1")])
--
- I cancel Task.
--
- !python {model: project.task}: |
- self.do_cancel(cr, uid, [ref("project_task_2")])