How To Create Email Notification Function In Odoo?
I have calender.event module. In that I have one date field ending_date. I wanted to create function when ending date exceeds current date it should send notification to all employ
Solution 1:
When I have to write a similar function, I wrote a condition checker and email sender function, and the cron call it regularly! It works well!
Solution 2:
You can create a cron, as the calendar module does [1]:
<recordforcecreate="True"id="ir_cron_scheduler_alarm"model="ir.cron"><fieldname="name">Run Event Reminder</field><fieldeval="False"name="active" /><fieldname="user_id"ref="base.user_root" /><fieldname="interval_number">30</field><fieldname="interval_type">minutes</field><fieldname="numbercall">-1</field><fieldeval="False"name="doall" /><fieldeval="'calendar.alarm_manager'"name="model" /><fieldeval="'get_next_mail'"name="function" /><!--<field eval="'(False,)'" name="args" />--></record>
In this case is calling the method get_next_mail
on calendar.alarm_manager
model. In your method you can do whatever you want. Also, this model looks like the right place where to put your code by extending it.
[1] https://github.com/OCA/OCB/blob/9.0/addons/calendar/calendar_cron.xml
Post a Comment for "How To Create Email Notification Function In Odoo?"