Repository navigation
[19.0][ADD] crm_lead_escalation: notify a manager about stalled leads - #764
JasminSForgeFlow wants to merge 1 commit into
Conversation
b7a49f5 to
5f9cc4f
Compare
5f9cc4f to
1f7ab10
Compare
f3afe2d to
46ed1e3
Compare
| # One unrenderable template or one unreadable lead must not | ||
| # roll back the escalations of every other recipient. | ||
| with self.env.cr.savepoint(): | ||
| self._escalate_batch(batch, recipient) |
There was a problem hiding this comment.
not big issue, but if _escalate_batch raises the leads are not marked as escalated
| @api.model_create_multi | ||
| def create(self, vals_list): | ||
| activities = super().create(vals_list) | ||
| # Planning a call or a meeting is working on the lead too. |
There was a problem hiding this comment.
don't understand this, can you explain?
There was a problem hiding this comment.
When a salesperson plans a call or meeting on a lead from the chatter, they are working on it, so the "no follow-up" clock restarts and the lead won't be escalated as stalled. Automated activities (planned by other modules, or the escalation's own activity) are excluded. I reworded the comment in the code to make this clearer.
| <field name="user_id" ref="base.user_root" /> | ||
| <field name="interval_number">5</field> | ||
| <field name="interval_type">minutes</field> | ||
| <field name="active" eval="True" /> |
|
|
||
| _logger = logging.getLogger(__name__) | ||
|
|
||
| ESCALATION_BATCH_SIZE = 1000 |
There was a problem hiding this comment.
perhaps we can use a system parameter to avoid hardcoding?
| """Warn ``recipient`` about ``leads``, in their own language.""" | ||
| self.ensure_one() | ||
| rule = self.with_context(lang=recipient.lang) | ||
| note = Markup("<p>%s</p>") % rule.env._( |
There was a problem hiding this comment.
can we move the note message to separate method?
| class MailActivity(models.Model): | ||
| _inherit = "mail.activity" | ||
|
|
||
| def _get_escalation_leads(self): |
There was a problem hiding this comment.
I find more natural a code where the activity calls a method on the related lead
Escalate leads that got no follow-up for a configurable delay, or that are still neither won nor lost since their creation. Each rule defines the delay, the sales teams and lead types it covers, and who is warned: the sales team leader or a specific user. The recipient gets a to-do activity and an email, and can optionally be made the salesperson of the lead. Any message, activity or stage change on the lead resets the escalation clock, so a lead stops being reported as soon as somebody works on it again.
46ed1e3 to
94cfac3
Compare
Escalate leads that got no follow-up for a configurable delay, or that are still neither won nor lost since their creation. Each rule defines the delay, the sales teams and lead types it covers, and who is warned: the sales team leader or a specific user. The recipient gets a to-do activity and an email, and can optionally be made the salesperson of the lead.
Any message, activity or stage change on the lead resets the escalation clock, so a lead stops being reported as soon as somebody works on it again.
@ForgeFlow