Projects:Print and Send/Configuration Guide
Contents |
Configuration Guide
Introduction
Actually Openbravo ERP allow print, attach and send by mail some specific documents (orders, shipment, and invoices). However if you want to print, attach or send by mail others documents (i.e. Work Requirements) or own customized documents you need to develop this processes manually. The aim of this module is allow print, attach and send by mail any document on any tab (from OB or from your own module) previous an easily configuration.
Before Start
This configuration guide assumes familiarity with Application Dictionary (Windows, tabs, fields, Tables and columns, Entities and Properties) and Reports.
The module have to be standard enough to work in any tab, so don't expected exactly the same functionality that have orders, shipments and invoices but yes a very similar one.
Print and Send Buttons
First step is decide in which tab and which functionality will be available.
A field called "Print and send functionality" allocated in "Tab" (Windows, Tabs and Fields) is used to decide the available functionality.
The possible values are:
- Print and send
Selecting this will show the corresponding icon:
and will make visible in "Column" (Table and Columns) the necessary combo to configure the functionality.
Important Note: Print and Send will not work until you complete the configuration described in this guide.
Print Configuration and Requirements
The table behind the tab in which we want to print and attach documents needs to follow some rules:
Document Type
Mandatory
As we will see, Document Type field are necessary to define the print format template for the document (*.jrxml template). This will permit print distinct print formats from the same tab based on the Document Type.
To define a Document Type at least one column in the table must have "Document Type" as target Entity. If there is only one this will be selected automatically , if you have more than one, you can use the combo "Report and Mail Options" located in "Column" to select one.
Report and Mail Options: Document Type
Important Note: Notice that as we are using properties and entities the name of the column are not relevant. For example these two columns will be considered:
COLUMN A
Name: C_Doctype_ID Reference: TableDir COLUMN B
Name: EM_MYMOD_DocType Reference: Table Reference Search Key: C_Doctype
Document Number
Mandatory
A document number is necessary to identify the record in a easy way. No matter how you implement the sequence of document number.
To define a Document No at least one column in the table must be String type and needs to have "Document Number" selected in the "Report and Mail Options" combo.
Report and Mail Options: Document Number
In case not find any column marked as "Document Number" a column type String will be looked for which contains (case insensitive):
DOC and (NO or NUM) (i.e. DocumentNumber, DocNo, EM_MYMOD_DOCUMENTNO, EM_MYMOD_DocNUM, etc...)
Print and Send Template requirements
Mandatory
A Tab under Document Type called "Print and Send Template" contains the info about the *.jrxml template.
You must write the complete path of the jrxml file (file name included). You should use @basedesign@:
i.e: @basedesign@/com/openbravo/gps/manufacturing/prodplan/report/WorkRequirementTab.jrxml
Available Parameters
There are 5 available parameters to use in your report.
4 of them are standard:
- BASE_DESIGN
- BASE_WEB
- LANGUAGE
- LOCALE
And one of them are the most relevant:
- DOCUMENT_ID
DOCUMENT_ID is the UUID of the record involved. Using this custom parameter you should be able to construct the query used in your jrxml report.
Attach
Once you can print, you can attach. Clicking the print button will show you a popup like this:
At this moment you should be able to print and attach.
Send Configuration and Requirements
There are two ways to send mails. One by One or Multiple sending. Sending mail will print, attach and send the document.
One by One
In this mode you can set all the fields involved in the email. If there are fields configured it will appear
Multiple
In this mode you should configure previously almost all fields involved in the email. Only CC and BCC will be available.
Requirement rules
Mailing | Email Conf | Mail To | Reply To | Reference Number | Document Status | Template | Log |
---|---|---|---|---|---|---|---|
One by One | Required | Optional | Optional | Optional | Optional | Optional | Optional |
Multiple | Required | Required | Optional | Optional | Optional | Required | Optional |
Email Configuration
Always mandatory
The email configuration is used to define the server which send the mail. It will take the standard configuration of the client. See Email Configuration.
Mail To
Mandatory for multiple sending
Mail To will define the recipientTo of the mail. There are two options to define the recipientTo.
Option 1: Mail To
Must be a column that have "User" as target Entity. Also is need to select "Mail To" in the field "Report and Mail Options" allocated in column.
The mail will be sent to this user.
- Report and Mail Options: Mail To
Notice that as we are using properties and entities the name of the column are not relevant.
Option 2: Partner Mail
Must be a column that have "Business Partner" as target Entity. Also is need to select "Partner Mail" in the field "Report and Mail Options" allocated in column.
The mail will be sent to a contact of the partner. If there is more than one contact you can use a check called "Default for sending mails" to select one by default.
Notice that as we are using properties and entities the name of the column are not relevant.
- Report and Mail Options: Partner Mail
Important notes:
- Both can be set at the same time. In this case the "Mail To" will have priority.
- Notice you can create a callout associated to the partner to fill the "Mail To" in order to support any logic
Reply To
Optional
Reply To will define the replyTo of the mail.
Must be a column that have "User" as target Entity. Also is need to select "Reply To" in the field "Report and Mail Options" allocated in column.
The mail will have this user in the Reply To field.
If it is not defined, the sender address defined in email configuration will be used as Reply To.
- Report and Mail Options: Reply To
Notice that as we are using properties and entities the name of the column are not relevant.
Reference Number
Optional
Sometimes is useful have the Reference Number of the document from the partner. To define a Reference Number the column must be String type and needs to have "Reference Number" selected in the "Report and Mail Options" combo.
- Report and Mail Options: Reference Number
Notice that as we are using properties and entities the name of the column are not relevant.
DocStatus
Optional
Sometimes is useful avoid sending mails in Draft Status. Defining this field will show an error if you try to send a mail with a document in Draft status. To define a Document Status the column must be "List" type with Reference Search key "All_Document Status" and needs to have "Document Status" selected in the "Report and Mail Options" combo.
- Report and Mail Options: Reference Number
Notice that as we are using properties and entities the name of the column are not relevant.
Print and Send Template / Email Definitions
Mandatory for multiple sending
A tab under "Print and Send Template" called Email Definitions, will be used for define the subject and the body for the mails. The mail-to-user default language will be used to select the email definition, if it's empty the logged user language will be used.
Notice that some auto-replacements will be done.
- @docNo@ will be replaced by document number
- @contactName@ (if defined) will be replaced by mail to user name
- @replyName@ (if defined) will be replaced by reply to user name
- @partnerName@ (if defined) will be replaced by business partner name
- @referenceNo@ (if defined) will be replaced by reference number
For example:
Dear @contactName@ Here you have the work requirement @docNo@ created to supply @partnerName@.
Regards,
@replyName@
will be
Dear Luis Rodríguez
Here you have the work requirement 10000042 created to supply Alimentos y Supermercados, S.A..
Regards,
Ana Cortés
Important Note: If some field are not defined will not be replaced and the @ expression will be sent.
Email Log
Optional
Email log is an optional text field that will show some info about the mails sent related to the document. It will show the mail date and time, the attachment sent and the recipient To.
Must be a column with reference Text. Should have a length of 4000 and should be read-only (in order to preserve the log). Need to select "Mail Log" in the field "Report and Mail Options" allocated in column.
- Report and Mail Options: Mail Log
Notice that as we are using properties and entities the name of the column are not relevant.
Error Management
There is some pre-validations before doing any action. The general rule is that if something goes wrong you will receive a message informing about the error and no action will be done.
i.e. You try to print and attach 5 reports and receive:
Error Document No: 10000040 has no document type defined.
In this case nothing will be printed nor attached.
But there is an exception. While sending multiple mails it can happen that all the pre-validation was ok but there was a problem sending some mails.
i.e. You try ton send 6 mails and receive:
Mail from document: 10000041 could not be sent. Reason: Invalid Addresses
In this case 5 mails will be sent and only one not. You could check it in the Mail Log if you configure it.
Notice that in this case the word "Error" doesn't appear.
As a general rule: If you receive the world Error doing any action (print, attach or send) no action was done.
If you receive an empty pop-up something was wrong and you should contact directly with me attaching a copy of your log file (usually openbravo.log)
For contact: rafael.demiguel at openbravo.com