Skip to Content
Menu
This question has been flagged

Hello everyone,
I'm currently in the process of configuring email notifications for certain key events. I would like to automate email notifications for the following scenarios:

  1. Notification for Unpaid Invoice: I want the system to automatically send an email to the client and the company director when an invoice becomes overdue and remains unpaid.

  2. Notification for Project Delay: I aim to have the project manager receive an email when any of our projects are delayed according to the planned schedule.

Does anyone have any advice or instructions on how to achieve this effectively within Odoo?

Any help would be greatly appreciated. Thank you in advance for your responses.


Best regards,


Avatar
Zrušiť
Best Answer

HI,
Using automated actions in Odoo, you can achieve it. 




Also you can check the follow up levels in the accounting application for sending the reminder emails



Thanks

Avatar
Zrušiť
Autor Best Answer

Thank you guys, you did it, you always save me :)

Avatar
Zrušiť
Best Answer

Hi,

You can achieve this functionality using a scheduled action. You can send the email notification using triggering a scheduled action.


example:

1)First create a scheduled action in a XML file

 <record id="run_mail_notification" model="ir.cron">
        <field name="name">Invoice: Email Notification Unpaid</field>
<field name="interval_number">1</field>
<field name="interval_type">hours</field>
        <field name="numbercall">-1</field>
        <field name="user_id" ref="base.user_root"/>
        <field name="doall" eval="False"/>
        <field name="model_id" ref="model_account.move"/>
<field name="code">model.run_unpaid_invoice_notification()</field>
        <field name="state">code</field>
    </record>

2) Write the Python function to execute the scheduled action in the model account.move by inheriting the model account.move


def run_unpaid_invoice_notification(self):

    not_paid_invoices = self.env['account.move].search([('payment_state','=','not_paid')])

    for rec in not_paid_invoices:

         email_values = {

'email_cc': False,

                    'email_to': rec.partner_id.email,

                }

                mail_template = self.env.ref(

'module_name.unpaid_invoice_mail')

mail_template.send_mail(http://rec.id" target="_blank" data-saferedirecturl="rec.id,

" rel="ugc">https://www.google.com/url?q=http://rec.id&source=gmail&ust=1710908582329000&usg=AOvVaw2eTE3bY3BBixRqBli-r2Kl">rec.id,

                                                              email_values=email_values,

force_send=True)


3) Create a mail template


 <record id="unpaid_invoice_mail" model="mail.template">
        <field name="name">Invoice: Unpaid State</field>
<field name="email_from">{{user.email}}</field>
<field name="subject">{{http://object.name" target="_blank" data-saferedirecturl="object.name" rel="ugc">https://www.google.com/url?q=http://object.name&source=gmail&ust=1710908582329000&usg=AOvVaw1SOx5zJQ2B5zQDmrv50O0V">object.name}} is still unpaid</field>
<field name="model_id" ref="module_name.model_account_move"/>
        <field name="auto_delete" eval="True"/>
        <field name="body_html" type="html">
            <div>
                <p>
<t t-out="http://object.name" target="_blank" data-saferedirecturl="object.name"/>
 " rel="ugc">https://www.google.com/url?q=http://object.name&source=gmail&ust=1710908582329000&usg=AOvVaw1SOx5zJQ2B5zQDmrv50O0V">object.name"/>
                    Is still in Unpaid state,
                    <br/>
                </p>
            </div>
        </field>
    </record>


Please check with the above codes to send an email notification when the amount is not paid.


In the same way you can send notifications for project delay

Please refer to the below blogs also:

How to configure scheduled action in odoo 17

How to Create an Email Template in Odoo 17


Hope it helps

Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
0
jún 15
3625
0
sep 23
1532
2
mar 24
6719
1
aug 22
3072
2
sep 20
4635