Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie

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?


Awatar
Odrzuć
Najlepsza odpowiedź

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



Thanks

Awatar
Odrzuć
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>

Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
maj 24
1155
0
wrz 23
1042
2
sie 23
3475
2
lut 24
81
1
gru 23
1835