İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
1975 Görünümler

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
Vazgeç
En İyi Yanıt

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



Thanks

Avatar
Vazgeç
Üretici

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

Üretici

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>

En İyi Yanıt

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

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
May 24
1163
0
Eyl 23
1049
2
Ağu 23
3493
2
Şub 24
81
1
Ara 23
1845