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]:
<record forcecreate="True" id="ir_cron_scheduler_alarm" model="ir.cron">
<field name="name">Run Event Reminder</field>
<field eval="False" name="active" />
<field name="user_id" ref="base.user_root" />
<field name="interval_number">30</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall" />
<field eval="'calendar.alarm_manager'" name="model" />
<field eval="'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?"