Recently i was involved in business process automation with ADempiere. Goal was to make most of the processes as automated as possible. With this post i would like to share my experience in Automatic Invoice printing and email sending to the end customers.
Out of the box ADempiere comes with a process called "
Print Invoices". It is located under "
Quote-to-Invoice"->"
Sales Invoices" in the main menu.
|
"Print Invoices" process parameters |
This process has few parameters(non of them is mandatory). Most of the parameters allow user to filter which Invoices to be printed based on: date range of Date Invoiced, Customer, Specific Invoice or Range of Invoice numbers. Top two parameters "
EMail PDF" and "
Mail Template" change behavior of "Print Invoices" process and turn it into email sending process.
Note: If you tick "EMail PDF" check-box then "Mail Template" parameter is also mandatory.
We will get back to the EMail sending functionality later.
Upon successful execution of "
Print Invoices" process, ADempiere displays total number of Invoices printed. Not so interesting screen for me but i wanted to give you idea how all steps look like.
|
"Print Invoices" result screen |
So far invoice printing produced paper Invoices for us. This was not so challenging to achieve, but i had to hack the code a bit as ADempiere always wanted to have at least one of the process parameters filled(either specific Invoice, Customer, Date range or Invoice number range). We wanted completely automated process, i.e. no user interaction or fixed process parameters.
It is time to move to the next question. Can we send automatically EMails to our customers with the same process?
As you might guess it should be possible. Every ERP system pretending to be modern should be able to send EMails. Steps to setup automatic EMail sending in ADempiere are quite easy.
"
Mail Template" window is located under: "
Partner Relations"-->"
Mail Template".
We have to enter Name of our EMail Template, Subject and Body(Mail Text). ADempiere allows us to use variables in the EMail body, so that we can have more personalized EMail messages. In this case i have used @Name@ to substitute name of the EMail recipient.
|
Mail Template |
After defining EMail template we should be able to manually start "
Print Invoices" process and to send personalized EMail messages with Invoices attached as PDF files.
- Schedule "Invoice Print" process
Second step from the setup process is to define scheduled execution of "Print Invoices" process.
We have to create new record in "
Scheduler" window. Most important here is to define which is the process we want to schedule, scheduled interval, name of the schedule and values of report parameters which ADempiere scheduler should pass to the process when invoking it.
|
Schedule |
We will define values of only two parameters:
- Parameter "EMail PDF". We will set default value to "Y"(Yes). This will instruct "Print Invoices" process to send EMails.
|
Parameter "EMail PDF" |
- Parameter "Mail Template". Here we have to set default value to be the ID of the "Mail Template" we created above. In my case this was 1 000 000.
|
Parameter "Mail Template" |
Now we are ready to test our new workflow. Please restart your application Server(Have to check)???
Comments