Skip to Content
Menu
This question has been flagged
5 Replies
5838 Views

Odoo v8 we are having problems with the 'Mark won' button under 'Sales > Opportunities'. When clicked it displays the following Odoo Warning!

Warning!

To relieve your sales pipe and group all Won opportunities, configure one of your sales stage as follow:
probability = 100 % and select "Change Probability Automatically".
Create a specific stage or edit an existing one by editing columns of your opportunity pipe.

We have one stage set to 100% and selected the "Change Probablility Automatically" box on all stages.

Here are the stages: (Sales > Configuration > Leads & Opportunities > Stages)

  • Stage Name               Probability (%)             Type 
  • ONE STAR                0.00                              Opportunity
  • TWO STAR               10.00                             Opportunity
  • THREE STAR           33.00                             Opportunity
  • FOUR STAR             66.00                             Opportunity
  • FIVE STAR Won       100.00                           Opportunity
  • Lost                           0.00                               Opportunity

Incidentially: The 'Mark Lost' button works as expected and sets the opportunity to the lost stage when clicked.

Any suggestions or help greatfully received. regards Richard

Avatar
Discard
Author

THANKS JAVIER! Your fix has worked. Would be good to get this into core so that it is not overwritten when we update our core.

Best Answer

we found the issue...  on crm_lead.py, replace the following methods:

 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.section_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 osv.except_osv(_('Warning!'),
                    _('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.section_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 osv.except_osv(_('Warning!'),
                    _('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

Avatar
Discard
Best Answer

You need to assign the stage to the sales teams at Sales/Sales/Sales Teams OR set "Default to New Sales Team" (case_default) to True under Sales / Config/L&O/Stages

Avatar
Discard
Author Best Answer

Ok since no response from the community on this one, I've continued experimenting with this issue. And in the spirit of the true universal technology fix it all solutions I addoped the switch it off and on again methology.

Step 1 - Delete the "FIVE STAR Won - 100%" stage (Sales > Configuration > Leads & Opportunities > Stages)

Step 2 - Refresh the page.

Step 3 - Create new stage "Won - 100%" (Here the bug persists unless you keep the Folded in Kanban view check box checked)

The "Mark as Won" button starts working again.

** BUG ** that remains in source code relates to not being able to have the Won Stage named anything other than "Won" and more annoyingly it must be a folded stage in the Kanban view. Maybe Odoo can check this out for a future release.

Avatar
Discard
Author

THANKS JAVIER! Your fix has worked. Would be good to get this into core so that it is not overwritten when we update our core.

Related Posts Replies Views Activity
2
Dec 19
7794
0
Nov 19
3160
1
Jul 19
5703
0
Jul 19
1571
1
May 17
7336