Ir al contenido
Menú
Se marcó esta pregunta

hi guys

I have a few leads in my stages that I want to remind the salesperson to follow up on that lead if it's been 2 weeks since the last change I made on them....

how can I do this?


How should the notification be displayed in this section?


Avatar
Descartar
Mejor respuesta

Hi,
You can create an automated action to generate the activities for the sales man.



Thanks

Avatar
Descartar
Autor

thanks but i dont want to set activity.actually i need to send web notification to salesperson and when i use notify_danger in res.users model,i get the error :

ValueError: <class 'TypeError'>: "'res.users' object is not callable" while evaluating
'model.send_notification_to_salesperson()'

can you show the code, you have added

Autor

py code:
def send_notification_to_salesperson(self):
current_date = datetime.now()
two_weeks_ago = current_date - timedelta(days=14)

forbidden_stages = self.env['crm.stage'].search(['|', ('is_won', '=', True), ('name', '=', 'Lost')]).mapped(
'id')
leads = self.env['crm.lead'].search(
[('stage_id', 'not in', forbidden_stages), ('write_date', '<', two_weeks_ago)])

for lead in leads:
lead.user_id.notify_danger("follow up")

cron code:

<record id="cron_send_notification" model="ir.cron">
<field name="name">Notification: Send Notification</field>
<field name="active" eval="True"/>
<field name="priority">4</field>
<field name="interval_type">days</field>
<field name="interval_number">1</field>
<field name="numbercall">-1</field>
<field name="nextcall" eval="(DateTime.now() + timedelta(days=0)).strftime('%Y-%m-%d 10:03:00')"/>
<field name="model_id" ref="model_crm_lead"/>
<field name="state">code</field>
<field name="code">model.send_notification_to_salesperson()</field>
</record>

Mejor respuesta

set the activity properly and set the followers of that salesperson on that particular leads

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
may 24
1115
0
sept 23
984
2
ago 23
3374
2
feb 24
81
1
dic 23
1788