(self, work_days=1, log=True)
return {
            'type': 'ir.actions.client',
            'tag': 'display_notification',
            'params': {
                'type': 'success',
                'title': _("Leads Assigned"),
                'message': notif_message,
                'next': {
                    'type': 'ir.actions.act_window_close'
                },
            }
        }
Manual (direct) leads assignment. This method both

          * assigns leads to teams given by self;
          * assigns leads to salespersons belonging to self;

        See sub methods for more details about assign process.

        :param float work_days: number of work days to consider when assigning leads
          to teams or salespersons. We consider that Member.assignment_max (or
          its equivalent on team model) targets 30 work days. We make a ratio
          between expected number of work days and maximum assignment for those
          30 days to know lead count to assign.

        :return action: a client notification giving some insights on assign
          process;
Manual (direct) leads assignment. This method both
Manual ( direct ) leads assignment . This method both
def action_assign_leads(self, work_days=1, log=True):
        """ Manual (direct) leads assignment. This method both

          * assigns leads to teams given by self;
          * assigns leads to salespersons belonging to self;

        See sub methods for more details about assign process.

        :param float work_days: number of work days to consider when assigning leads
          to teams or salespersons. We consider that Member.assignment_max (or
          its equivalent on team model) targets 30 work days. We make a ratio
          between expected number of work days and maximum assignment for those
          30 days to know lead count to assign.

        :return action: a client notification giving some insights on assign
          process;
        """
        teams_data, members_data = self._action_assign_leads(work_days=work_days)

        # format result messages
        logs = self._action_assign_leads_logs(teams_data, members_data)
        html_message = '<br />'.join(logs)
        notif_message = ' '.join(logs)

        # log a note in case of manual assign (as this method will mainly be called
        # on singleton record set, do not bother doing a specific message per team)
        log_action = _("Lead Assignment requested by %(user_name)s", user_name=self.env.user.name)
        log_message = "<p>%s<br /><br />%s</p>" % (log_action, html_message)
        self._message_log_batch(bodies=dict((team.id, log_message) for team in self))

        return {
            'type': 'ir.actions.client',
            'tag': 'display_notification',
            'params': {
                'type': 'success',
                'title': _("Leads Assigned"),
                'message': notif_message,
                'next': {
                    'type': 'ir.actions.act_window_close'
                },
            }
        }
def action_assign_leads ( self , work_days = 1 , log = True ) : teams_data , members_data = self . _action_assign_leads ( work_days = work_days ) # format result messages logs = self . _action_assign_leads_logs ( teams_data , members_data ) html_message = '<br />' . join ( logs ) notif_message = ' ' . join ( logs ) # log a note in case of manual assign (as this method will mainly be called # on singleton record set, do not bother doing a specific message per team) log_action = _ ( "Lead Assignment requested by %(user_name)s" , user_name = self . env . user . name ) log_message = "<p>%s<br /><br />%s</p>" % ( log_action , html_message ) self . _message_log_batch ( bodies = dict ( ( team . id , log_message ) for team in self ) ) return { 'type' : 'ir.actions.client' , 'tag' : 'display_notification' , 'params' : { 'type' : 'success' , 'title' : _ ( "Leads Assigned" ) , 'message' : notif_message , 'next' : { 'type' : 'ir.actions.act_window_close' } , } }