How to create a new ODT template in Tactic
Introduction:
ODT stands for OpenDocument Text, which is a file type that is used for documents edited with word processors. The primary benefits that are associated with ODT files are that these are open-source and are compatible with multiple applications. Tactic allows you to create ODT templates for your documents in Tactic to enhance your experience of using the SaaS in a more personalized manner.
Requirements:
The customers are required to access ODT templates via OpenOffice or LibreOffice.
Creating an ODT template:
Creating an ODT template is rather easy. All you need to do is to follow two steps:
- Open an empty OpenOffice document and start editing it using all the Office suite features.
- Include the tags that will define the criteria of your ODT template. These tags will be replaced by Tactic during the document generation process.
The list of all available tags is provided in the following segment of the tutorial. Tags: The list of the tags is provided in this segment. Please note that the tags must be rounded with {} or [] as arrays need to be typed without any stop while using OpenOffice. Otherwise, OpenOffice adds invisible information that makes the task of detection and replacement impossibly tough. You can use Ctrl + M to remove direct formatting from Tags in LibreOffice.
Company/Organization information:
The list of tags associated with Company or organization information is presented below:
{mycompany_logo} : Your company logo {mycompany_name} : Your company name {mycompany_address} : Your company address {mycompany_zip} : Your company zip {mycompany_town} : Your company town {mycompany_country} : Your company country (label) {mycompany_country_code} : Your company country (code: FR, US, IT...) {mycompany_state} : Your company state (label) {mycompany_state_code} : Your company state (code) {mycompany_phone} {mycompany_fax} {mycompany_email} {mycompany_web} {mycompany_barcode} {mycompany_capital} {mycompany_juridicalstatus} {mycompany_managers} {mycompany_idprof1} {mycompany_idprof2} {mycompany_idprof3} {mycompany_idprof4} {mycompany_idprof5} {mycompany_idprof6} {mycompany_vatnumber} : Your company VAT number {mycompany_object} {mycompany_note_private} : Your company private note
Customer, Supplier or Prospect information:
The list of tags associated with customer, supplier or prospect information is presented below:
{company_name} : Customer or Supplier company name {company_name_alias} {company_address} {company_zip} {company_town} {company_country} : Customer or Supplier company country (label) {company_country_code} : Customer or Supplier company country (code: FR, US, IT...) {company_state} {company_state_code} {company_phone} {company_fax} {company_email} {company_web} {company_barcode} {company_customercode} : Company customer code {company_suppliercode} : Company supplier code {company_customeraccountancycode} : Company customer accountancy code {company_supplieraccountancycode} : Company supplier accountancy code {company_capital} {company_juridicalstatus} {company_outstanding_limit} {company_idprof1} {company_idprof2} {company_idprof3} {company_idprof4} {company_idprof5} {company_idprof6} {company_vatnumber} : Customer or Supplier company VAT number {company_note_public} : Customer or Supplier company public note {company_note_private} : Customer or Supplier company private note {company_default_bank_iban} {company_default_bank_bic}
Extra fields:
{company_options_xxx} : Value of extra field (where xxx is code of extra field)
Contacts information:
The list of contact information is presented below: Please note that these contact related tags can be used in three different cases, which are:
- In invoices
- In proposals of quotations
- In sales orders
It needs to be stated that there are no tags available for delivery contacts alongside other type of documents that are not supported by Tactic.
{contact_civility} {contact_fullname} {contact_lastname} {contact_firstname} {contact_address} {contact_zip} {contact_town} {contact_state_id} {contact_state_code} {contact_state} {contact_country_id} {contact_country_code} {contact_country} {contact_poste} {contact_socid} {contact_statut} {contact_code} {contact_email} {contact_jabberid} {contact_phone_pro} {contact_phone_perso} {contact_phone_mobile} {contact_fax} {contact_birthday} {contact_default_lang} {contact_note_public} {contact_note_private}
Extra fields:
{contact_options_xxx} : Value of extra field (where xxx is code of extra field)
For adding contact related information to an ODT template you may also need to urround the substitutions variables with
[!-- BEGIN companycontacts--][!-- END companycontacts--]
User information:
The list containing user information related tags are presented below:
{myuser_lastname} {myuser_firstname} {myuser_fullname} {myuser_phone} {myuser_fax} {myuser_mobile} {myuser_address} {myuser_login} {myuser_email} {myuser_zip} {myuser_town} {myuser_country} {myuser_country_code} {myuser_state} {myuser_state_code} {myuser_logo} {myuser_job} {myuser_web}
Other information:
Tags related to other important information are presented below:
{current_date} {current_datehour} {current_server_date} {current_server_datehour} {current_date_locale} {current_datehour_locale} {current_server_date_locale} {current_server_datehour_locale}
{__(XXX)__} = Translated value of a translation key XXX - Note: Translation must be inside a language file that was previously loaded with $langs->load("languagefile") {__[XXX]__} = Value of the constant XXX (into setup)
You may also use
{__XXX__} = To use a constant defined for email templates, that may also be available into ODT templates. For exemple {__ONLINE_PAYMENT_URL__}, {__DAY__}, {__REF__}, ...
In this scenario object here refers to invoices, quotations, orders and so on. Please note that if there is _locale at the end of a tag, it means that the output value will be in your local language of the targeted language for generation instead of the default format or language.
{object_id} {object_ref} {object_ref_ext} {object_label} {object_ref_customer} {object_ref_supplier} {object_note_private} {object_note_public}
or
{object_note}
Dates
{object_hour} {object_date} {object_date_rfc} {object_date_creation} {object_date_modification} {object_date_validation} {object_date_limit} : Specific to invoices {object_date_end} : Specific to proposals : End date of validity of proposal {object_date_delivery_planed} : Specific to order {object_date_close}
Amounts (numeric data):
{object_total_ht} {object_total_vat} {object_total_localtax1} {object_total_localtax2} {object_total_ttc} {object_total_discount_ht} {object_total_vat_x} (is vat total for rate x. x can be for example 20, 8.5, 5.99 ... See also note*}
Amounts (in output language format):
{object_total_ht_locale} {object_total_vat_locale} {object_total_localtax1_locale} {object_total_localtax2_locale} {object_total_ttc_locale} {object_total_discount_ht_locale} {object_total_vat_locale_x} (is vat total for rate x. x can be for example 20, 8.5, 5.99 ... See also note*}
Multicurrency:
{object_multicurrency_code} {object_multicurrency_tx} {object_multicurrency_total_ht} {object_multicurrency_total_tva} {object_multicurrency_total_ttc} {object_multicurrency_total_ht_locale} {object_multicurrency_total_tva_locale} {object_multicurrency_total_ttc_locale}
Specific to proposals :
{object_availability_id} {object_availability_code} {object_availability}
Specific to invoices :
{object_payment_mode} {object_payment_mode_code} {object_payment_term} {object_payment_term_code} {object_incoterms} {object_bank_iban} {object_bank_bic} {object_bank_label} {object_bank_number} {object_bank_proprio} {object_source_invoice_ref} {object_already_payed} : Amount already payed (numeric) {object_already_deposit} {object_already_creditnote} {object_already_payed_all} {object_remain_to_pay} : Remaining to pay amount (numeric) {object_already_payed_locale} : Amount already payed (output language format) {object_already_deposit_locale} {object_already_creditnote_locale} {object_already_payed_all_locale} {object_remain_to_pay_locale} : Remaining to pay amount (output language format)
Specific to Shipments :
{object_date_delivery} {object_hour_delivery} {object_tracking_number} {object_tracking_url} {object_shipping_method} {object_weight} {object_width} {object_height} {object_depth} {object_size} {order_ref} : Ref of origin order used to generate the shipment {order_ref_customer} : Ref on customer side of origin order used to generate the shipment
Specific to the Project linked to the object (if applicable):
{object_project_ref} {object_project_title} {object_project_description} {object_project_date_start} {object_project_date_end}
Specific to the Product directly linked to the object (if applicable):
{object_product_ref} {object_product_label}
Extra fields:
{object_options_xxx} : Value of extra field (where xxx is code of extra field)
For ODT with supplier prices, you may need also to surround the substitutions variables with
[!-- BEGIN supplierprices--][!-- END supplierprices--]
Please note that, For the tag {object_total_..._x}, if there is no amount for the vat rate x, the key is not replaced. So you can use the condition syntax to show 0 instead of the key when value is not defined:
[!-- IF {object_total_..._x} --] 0 [!-- ELSE {object_total_..._x} --] {object_total_..._x} [!-- ENDIF {object_total_..._x} --]
Warning: Making sure that this part of the code does not contain any kind of hidden text is important to make the tag work. Hence, you need to select the code section and remove all the direct formatting by right clicking on the mouse.
Lines of object:
Using arrays for lines of object is a little tricky. You need to create your array in a document and use a start and end tag to define it as a line of the array. This line then will be repeated as much as required during generation.
[!-- BEGIN row.lines --] ... [!-- END row.lines --]
If you want to display it not in tables row but in block lines then you can use:
[!-- BEGIN lines --] ... [!-- END lines --]
Then, you can use the following tags into your line (in addition to any other tags of the document):
{line_pos} {line_desc} {line_product_ref} {line_product_ref_fourn} {line_product_label} {line_product_type} {line_product_barcode} {line_vatrate} {line_localtax1_rate} {line_localtax2_rate} {line_up} {line_up_locale} {line_qty} {line_discount_percent} {line_price_ht} {line_price_ht_locale} {line_price_vat} {line_price_vat_locale} {line_price_ttc} {line_price_ttc_locale} {line_date_start} {line_date_start_locale} {line_date_start_rfc} {line_date_end} {line_date_end_locale} {line_date_end_rfc} {line_unit} : Needs PRODUCT_USE_UNITS to 1 {line_unit_short} : Needs PRODUCT_USE_UNITS to 1
{line_fulldesc} : contains both line_desc and line_product_ref and line_product_label
Multicurrency :
{line_multicurrency_code} {line_multicurrency_subprice} {line_multicurrency_total_ht} {line_multicurrency_total_tva} {line_multicurrency_total_ttc} {line_multicurrency_subprice_locale} {line_multicurrency_total_ht_locale} {line_multicurrency_total_tva_locale} {line_multicurrency_total_ttc_locale}
Specific to Shipments :
{line_qty_shipped} {line_qty_asked} {line_weight} {line_length} {line_surface} {line_volume}
Extra fields:
{line_options_xxx} : Value of extra field (where xxx is code of extra field) {line_product_options_xxx} : If the line is a product, Value of the Product extra filed (where xxx is code of Product extra field)
The list containing project and task related tags are presented below,
{tasktime_rowid} {tasktime_task_date} {tasktime_task_duration} {tasktime_task_duration_sec} {tasktime_note} {tasktime_fk_user} {tasktime_user_name} {tasktime_user_first} {tasktime_fullcivname}
For projects ODT, you may need also to surround the substitutions variables with,
[!-- BEGIN projectcontacts --][!-- END projectcontacts --] [!-- BEGIN projectfiles --][!-- END projectfiles --] [!-- BEGIN projectrefs --][!-- END projectrefs --] [!-- BEGIN tasks --][!-- END tasks --]
For Tasks ODT, you may need also to surround the substitutions variables with
[!-- BEGIN tasksressources--][!-- END tasksressources--] [!-- BEGIN taskstimes--][!-- END taskstimes--] [!-- BEGIN tasksfiles--][!-- END tasksfiles--] [!-- BEGIN projectfiles--][!-- END projectfiles--] [!-- BEGIN projectcontacts--][!-- END projectcontacts--]
Conditional substitution:
Tactic allows you to use conditional substitutions, which means you can use a tag if a variable is true or print something else if it is false. You can also print more complex structures like tables and images. An example is provided below:
[!-- IF {my_var} --] Print this text if {my_var} is true (can be any value but null/0/empty string) [!-- ELSE {my_var} --] Or print this if it's false (null/0/empty string) [!-- ENDIF {my_var} --]
Please note that the ELSE tag and block is optional, you can just use IF/ENDIF if you prefer.
Warning: The format of this special tag is very precise and picky, be careful to put one space between:
- [!--
- IF/ELSE/ENDIF
- {my var}
- --]
Warning: String must be typed with no stop using Office suite (with no backward and no copy-paste). If not doing that, Office suite add some invisible information making detection/replacement of text not possible.
Uploading your ODT template in Tactic:
Once you are done with creating your own ODT template, you can upload the same in Tactic to start generating PDFs in your customised template. You need to go through a few small steps to achieve the same. The steps are mentioned below:
- Go to homepage -> setup menu from the side menu bar -> modules and applications -> choose the preferred module (i.e. invoice, sales orders, quotations etc.) -> click on the cog sign.
- Now go to Order documents models that you can find in the first page.
- There you will be able to see an option called ODT templates at the end of the table.
- Go to “upload new template” -> click on browse -> click on upload.
- Now you can generate your documents in the ODT format that you created yourself.