Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
2 Respostas
1979 Visualizações

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
Cancelar
Melhor resposta

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



Thanks

Avatar
Cancelar
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>

Melhor resposta

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

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
0
mai. 24
1174
0
set. 23
1054
2
ago. 23
3506
2
fev. 24
81
1
dez. 23
1852