Create an ODT or ODS document template: Difference between revisions

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search

Revision as of 08:53, 14 March 2011

This page describe how to build an ODT document template to build documents using ODT generation.

Prerequisite

  • Dolibarr: 3.1+
  • OpenOffice: 3.2+

Create your document

  • Create from scratch an empty openoffice document and take a provided example.

They are installed into a subdirectory of directory documents/doctemplates

  • Edit your document using all your office suite features.

Include in your document the tags you want to see. Tags will be replaced during generation of document automatically by Dolibarr. List of all available tags are provided in next chapter.

Tags

This is a list of tags that will be replaced with your informations:

Company/foundation information

mycompany_logo = {mycompany_logo}
mycompany_name = {mycompany_name}
mycompany_address = {mycompany_address}
mycompany_zip = {mycompany_zip}
mycompany_town = {mycompany_town}
mycompany_country = {mycompany_country}
mycompany_phone = {mycompany_phone}
mycompany_fax = {mycompany_fax}
mycompany_email = {mycompany_email}
mycompany_web = {mycompany_web}
mycompany_barcode = {mycompany_barcode}
mycompany_capital= {mycompany_capital}
mycompany_juridicalstatus= {mycompany_juridicalstatus}
mycompany_idprof1 = {mycompany_idprof1}
mycompany_idprof2 = {mycompany_idprof2}
mycompany_idprof3 = {mycompany_idprof3}
mycompany_idprof4 = {mycompany_idprof4}
mycompany_vatnumber = {mycompany_vatnumber}
mycompany_note = {mycompany_note}
...

Customers, prospects or suppliers information

company_name = {company_name}
company_address = {company_address}
company_zip = {company_zip}
company_town = {company_town}
company_country = {company_country}
company_phone = {company_phone}
company_fax = {company_fax}
company_email = {company_email}
company_web = {company_web}
company_barcode = {company_barcode}
company_customercode = {company_customercode}
company_suppliercode = {company_suppliercode}
company_capital = {company_capital}
company_juridicalstatus = {company_juridicalstatus}
company_idprof1 = {company_idprof1}
company_idprof2 = {company_idprof2}
company_idprof3 = {company_idprof3}
company_idprof4 = {company_idprof4}
company_vatnumber = {company_vatnumber}
company_note = {company_note}

User information

myuser_lastname = {myuser_lastname}
myuser_firstname = {myuser_firstname}
myuser_login = {myuser_login}
myuser_email = {myuser_email}
...

Object information (invoice, commercial proposal, order, ...)

object_id = {object_id}
object_ref = {object_ref}
object_ref_customer = {object_ref_customer}
object_ref_supplier = {object_ref_supplier}
object_date = {object_date}
object_date_creation = {object_date_creation}
object_date_validation = {object_date_validation}
object_total_ht = {object_total_ht}
object_total_vat = {object_total_vat}
object_total_ttc = {object_total_ttc}
object_vatrate = {object_vatrate}
object_note_private = {object_note_private}
object_note = {object_note}
...

Lines of object

This is how to use arrays for lines of objects (invoices, commercial proposal, orders, etc...). You must create your array in the document and use a begin and end tag to define a line of the array. The line will then be repeated as much as required during generation.

[!-- BEGIN row.lines --]
...
[!-- END row.lines --]

This an example of what you may have in your office suite: Line for document generation.png

Then, you can use following tags into your line:

	{line_fulldesc}
	{line_vatrate}
	{line_up}
	{line_qty}
	{line_discount_percent}
	{line_price_ht}
	{line_price_vat}
	{line_price_ttc}

Store your document

To have your document to appear in list of available documents, put it into correct subdirectory found into directory documents/doctemplates