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

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,


Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
cze 15
3862
0
wrz 23
1681
2
mar 24
6951
1
sie 22
3251
2
wrz 20
4950