diff options
| author | Fabien Pinckaers <fp@openerp.com> | 2015-07-13 14:04:50 -0700 |
|---|---|---|
| committer | Fabien Pinckaers <fp@openerp.com> | 2015-07-13 14:04:50 -0700 |
| commit | ecd410a3eea964ed33c6b706b0a025dfdc99f166 (patch) | |
| tree | 1b9766eeedcf7c90667c6957147cde547fd3f965 | |
| parent | b6418a116d5b1b9e6763bf1886ac94423ae02b68 (diff) | |
[FIX] removing Mark Won/Loss, use stages instead
| -rw-r--r-- | addons/crm/crm_lead.py | 38 | ||||
| -rw-r--r-- | addons/crm/crm_lead_view.xml | 19 | ||||
| -rw-r--r-- | addons/crm/test/crm_lead_find_stage.yml | 11 | ||||
| -rw-r--r-- | addons/crm/test/lead2opportunity2win.yml | 13 |
4 files changed, 0 insertions, 81 deletions
diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 5f3da3ad81f..b3fb5b764a1 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -341,44 +341,6 @@ class crm_lead(format_address, osv.osv): return stage_ids[0] return False - def case_mark_lost(self, cr, uid, ids, context=None): - """ Mark the case as lost: state=cancel and probability=0 - """ - stages_leads = {} - for lead in self.browse(cr, uid, ids, context=context): - stage_id = self.stage_find(cr, uid, [lead], lead.team_id.id or False, [('probability', '=', 0.0), ('on_change', '=', True), ('sequence', '>', 1)], context=context) - if stage_id: - if stages_leads.get(stage_id): - stages_leads[stage_id].append(lead.id) - else: - stages_leads[stage_id] = [lead.id] - else: - raise UserError(_('To relieve your sales pipe and group all Lost opportunities, configure one of your sales stage as follow:\n' - 'probability = 0 %, select "Change Probability Automatically".\n' - 'Create a specific stage or edit an existing one by editing columns of your opportunity pipe.')) - for stage_id, lead_ids in stages_leads.items(): - self.write(cr, uid, lead_ids, {'stage_id': stage_id}, context=context) - return True - - def case_mark_won(self, cr, uid, ids, context=None): - """ Mark the case as won: state=done and probability=100 - """ - stages_leads = {} - for lead in self.browse(cr, uid, ids, context=context): - stage_id = self.stage_find(cr, uid, [lead], lead.team_id.id or False, [('probability', '=', 100.0), ('on_change', '=', True)], context=context) - if stage_id: - if stages_leads.get(stage_id): - stages_leads[stage_id].append(lead.id) - else: - stages_leads[stage_id] = [lead.id] - else: - raise UserError(_('To relieve your sales pipe and group all Won opportunities, configure one of your sales stage as follow:\n' - 'probability = 100 % and select "Change Probability Automatically".\n' - 'Create a specific stage or edit an existing one by editing columns of your opportunity pipe.')) - for stage_id, lead_ids in stages_leads.items(): - self.write(cr, uid, lead_ids, {'stage_id': stage_id}, context=context) - return True - def log_next_activity_1(self, cr, uid, ids, context=None): return self.log_next_activity_done(cr, uid, ids, next_activity_name='activity_1_id', context=context) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 5ba5b7412ac..cd4162ac7a6 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -380,8 +380,6 @@ <field name="arch" type="xml"> <form string="Opportunities"> <header> - <button name="case_mark_won" string="Mark Won" attrs="{'invisible': [('probability', '=', 100)]}" type="object" class="oe_highlight"/> - <button name="case_mark_lost" string="Mark Lost" attrs="{'invisible': [('probability', '=', 100)]}" type="object" class="oe_highlight"/> <field name="stage_id" widget="statusbar" clickable="True" options="{'fold_field': 'fold'}" domain="['&', ('team_ids', '=', team_id), '|', ('type', '=', type), ('type', '=', 'both')]"/> @@ -639,22 +637,5 @@ <field name="ref_ir_act_window" ref="crm.action_lead_mass_mail"/> </record> - <record id="action_mark_as_lost" model="ir.actions.server"> - <field name="name">Mark As Lost</field> - <field name="model_id" ref="model_crm_lead"/> - <field name="state">code</field> - <field name="code"> - if context.get('active_model') == 'crm.lead' and context.get('active_ids'): - self.case_mark_lost(cr, uid, context['active_ids'], context=context) - </field> - </record> - - <record id="ir_mark_as_lost" model="ir.values"> - <field eval="'client_action_multi'" name="key2"/> - <field eval="'crm.lead'" name="model"/> - <field name="name">Mark As Lost</field> - <field eval="'ir.actions.server,%d'%action_mark_as_lost" name="value"/> - </record> - </data> </openerp> diff --git a/addons/crm/test/crm_lead_find_stage.yml b/addons/crm/test/crm_lead_find_stage.yml index c9cf82b9cb6..37758f2c038 100644 --- a/addons/crm/test/crm_lead_find_stage.yml +++ b/addons/crm/test/crm_lead_find_stage.yml @@ -30,14 +30,3 @@ assert stage_id == stage['id'], "Default stage of opportunity is incorrect!" - Now I change the stage of opportunity to won. -- - !python {model: crm.lead}: | - self.case_mark_won(cr, uid, [ref("test_crm_lead_new")]) -- - I check statge of opp should won, after change stage. -- - !python {model: crm.lead}: | - opp = self.browse(cr, uid, ref('test_crm_lead_new')) - stage_id = self.stage_find(cr, uid , [opp], opp.team_id.id or False,[('probability','=',100.0)], context) - assert stage_id == opp.stage_id.id, "Stage of opportunity is incorrect!" - diff --git a/addons/crm/test/lead2opportunity2win.yml b/addons/crm/test/lead2opportunity2win.yml index 749eb9b66ad..17caa7f3a77 100644 --- a/addons/crm/test/lead2opportunity2win.yml +++ b/addons/crm/test/lead2opportunity2win.yml @@ -64,19 +64,6 @@ assert opp.type == 'opportunity', 'Lead is not converted to opportunity!' assert opp.stage_id.id == ref("stage_lead1"), 'Stage of probability is incorrect!' - - I loose the second opportunity -- - !python {model: crm.lead}: | - self.case_mark_lost(cr, uid, [ref("crm_case_2")]) -- - I check details of the opportunity after the loose -- - !python {model: crm.lead}: | - lead = self.browse(cr, uid, ref('crm_case_2')) - 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. - !python {model: calendar.event}: | |
