Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Sales > Opportunities - Mark Won button not working?

By
Richard Branson
on 1/28/15, 12:04 PM 1,294 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

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.

Richard Branson
on 2/27/15, 6:06 AM
1
Javier Cárdaba
On 2/26/15, 6:21 AM

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

0
Richard Branson
On 2/2/15, 1:11 PM

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.

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.

Richard Branson
on 2/27/15, 6:05 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/28/15, 12:04 PM
Seen: 1294 times
Last updated: 3/16/15, 8:10 AM