Email notification

Description:

Tryton is able to trigger action based on record change. The idea is to have a module that provides a way to the user to define email template for a kind record that could be used by a triggered action to send email to a list of users. For example, it should be possible to send an email to the customer when its sale order is validated.

Skills:

Knowledge in Python and Template engine like Genshi.

Difficulty level:

Intermediate

Potential mentors:

Implementation

https://bugs.tryton.org/issue5835

We have some modules that implement such functionality:

https://bitbucket.org/nantic/trytond-electronic_mail
https://bitbucket.org/nantic/trytond-electronic_mail_template
https://bitbucket.org/nantic/trytond-electronic_mail_wizard

So maybe they can be taked in account as a base.

We should not create mailbox nor queue. Tryton is not the right tool for such things.
Indeed the development should be based on the future two-phase commit.
Also the templating should re-use as much as possible the Report infrastructure.

I would love to be involved in this.

Yes, this idea is about email notifications or alerts, not the functionality of a user sending an email from Tryton like they would from an email client.

This is about setting up a workflow for email notifications with rules. Perhaps we should be able to trigger an email if a field is changed to a particular value? Perhaps we could have a more complicated formula with many fields.

This is already managed in a very flexible way by the ir.trigger.

1 Like

Hello!

Could you explain in a few words the mechanism of ir.trigger? I want to know if Tryton has some kind of observer pattern mechanism like signals and slots in Qt. I am looking for an open source server side component for an healthcare software project (freemedforms) with this feature to automate notifications based on (clinical) rules. I guess GNU Health could benefit from such a feature too.

Thanks.

The ir trigger allows to define a method that will be called on the following events:

  • Record Creation
  • Record Modification
  • Record Deletion

You can also specify a condition on the trigger to limit the affected records.

This allow, for example, to call a trigger when a sale order is confirmed.
So with the email notification feature we will allow to send an email when the sale order is confirmed.

You have a lot of examples in the tests methods:

http://hg.tryton.org/trytond/file/tip/trytond/tests/test_trigger.py#l73

Instead of answering here (which will be bury deeper in discourse), you should add it to the documentation.

Just for the follow-up, i created Issue 5699: Add docs about ir.trigger - Tryton issue tracker to add docs about ir.trigger

I’m wondering if we should include it as trytond base instead of using a new module.

If it is possible to just make a module, it is always better.

I am wondering if it is possible has two options for to trigger the send email, by ir.trigger and by ir.cron, for example we want to schedule with CRON option send mail to all customers when a invoice is past due bill, and this CRON is set a specific hour or day of week.

Triggers can be based also on time, so for me this will be supported.

A little bit of topic but this is managed by dunning module.