Skip to main content

Automatic Invoice Printing/Emailing in ADempiere

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.

  • Define Mail Template.
"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:

  1. Parameter "EMail PDF". We will set default value to "Y"(Yes). This will instruct "Print Invoices" process to send EMails.

Parameter "EMail PDF"
  1. 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

Popular posts from this blog

Compiere vs. ADempiere: Count of Partners

ADempiere project is one year old now, more precisely 13 months old. Before one year father project Compiere had around 60 partners, which was quite good number. Each partner was obliged to pay 3 000 USD per year which made 180 000 USD income only from partners. Today Compiere has 32 partners and each pays 8 000 USD = 256 000 USD year. It looks that Compiere Inc. managed to increase it's income, but number of partner dropped by half. It is Compiere inc. decision how much to charge for partnership, i'm not going to discuss this now. But it is very interesting observation that although income from partners increased Compiere Inc. decided to close source code access to Service Packs and push users to pay for it. It looks that only money from partners are not enough for the Inc.. Well it is again Compiere Inc. right to decide how much to charge for access to source code and how much not to charge, but users can see that functionality which ADempiere provides get bigger and bigger e

Compiere - Beginning of the end!

Compiere Inc. has very strange understandings for free: http://compiere.com/support/service-packs.php Is there a charge for downloading these service packs? The Service Pack is free of charge for customers on Standard and Extended level support subscriptions. For 2.6.3, the Service Pack is also available to customers on Self-service Support Subscriptions at no charge. Acording to the post all is free, but user must have subscription... We at ADempiere are totaly free as our migration and bug fixes which are more than 500 till now are free even for non subscribed users. One big THANK YOU to Compiere Inc. for leaving the battle field OPEN SOURCE to ADempiere and other forks. Trifon Trifonov

How to catch right mouse click in JTable

This is a quick post to show how developer can intercept Right mouse click in JTable. Name  of our JTable object is "jTable". We need to add MouseListener and catch "MousePressed" events. As the code shows correct mouse button is determined using "SwingUtilities" class, quite easy job. Tricky part is finding Row number and Column number and displaying Pop-up window at correct position. Enjoy! jTable.addMouseListener( new MouseAdapter() { public void mousePressed( MouseEvent event ) { if ( SwingUtilities.isLeftMouseButton( event ) ) { // Do something } else if ( SwingUtilities.isRightMouseButton( event ) ) { Point p = event.getPoint(); // Get row and column index that contains our coordinate int rowIndex = jTable.rowAtPoint( p ); int colIndex = jTable.columnAtPoint( p ); // Get ListSelectionModel of the JTable ListSelectionModel model = jTable.getSelectionModel(); // Set how many rows are selected using "rowInd