How to Create a Custom Quote in Dolibarr (Template + Step-by-Step Tutorial)
   05/16/2025 00:00:00     Dolibarr , Wiki Dolibarr    0 Comments
How to Create a Custom Quote in Dolibarr (Template + Step-by-Step Tutorial)

Creating professional, branded, and customized quotes (proposals or estimates) is essential for any business. It reflects your brand’s identity and helps you communicate clearly with your clients. If you’re using Dolibarr ERP & CRM to manage your operations, you’ll find that the quoting system is powerful, but the default quote templates may not always meet your visual or functional expectations. The good news is: Dolibarr allows you to create fully customized quote templates—tailored to your business needs.

This article provides a complete guide to building a custom quote in Dolibarr, including:

  • A full explanation of how quote generation works in Dolibarr

  • The structure of quote templates and how they integrate with the system

  • A step-by-step tutorial to create and activate a new custom template

  • How to modify layout, add logos, or insert custom fields

  • Common mistakes and how to avoid them

  • Tips for upgrading or maintaining your templates over time

Whether you are a developer, freelancer, or small business owner, this guide will walk you through everything you need to know—without assuming prior programming knowledge.


Understanding How Quotes Work in Dolibarr

In Dolibarr, quotes (also called “proposals” or “commercial offers”) are documents created in the Commercial module. They are generated based on the data you input via the GUI: customer info, products/services, pricing, taxes, and more.

Dolibarr stores quote content in the database, but the generated PDF document comes from a PHP template file that controls layout, structure, and formatting.

Here’s the basic workflow:

  1. User creates a quote via the GUI.

  2. Dolibarr uses a PHP file (called a "model") to generate a PDF.

  3. The template pulls data from the database and uses HTML/CSS/FPDF logic to render it.

There are several default models (like crabe, azur, einstein), but they are generic and not always aesthetically aligned with a brand. That’s where custom quote templates come in.


Why Customize a Quote Template?

The default templates are functional, but often limited in terms of:

  • Branding (logo size/position, colors, fonts)

  • Layout (column arrangement, header/footer info)

  • Local standards (specific tax wording, languages)

  • Custom data fields (e.g. internal references, project codes)

By creating a custom quote template, you can:

  • Enhance your company's professional image

  • Include unique information specific to your workflows

  • Translate or localize the document for specific markets

  • Maintain consistent formatting across all communications


Step 1: Set Up Your Development Environment

Before customizing anything, you need access to the Dolibarr file structure. This typically means:

  • Access to your server or local Dolibarr installation

  • Ability to edit PHP files

  • Knowledge of the Dolibarr installation path, typically something like: /var/www/html/dolibarr/

The quote models are stored in:
htdocs/core/modules/propale/doc/

Note: Any changes you make to core templates may be overwritten during updates. That’s why you should always create a copy of a template and work with that instead of editing an existing one.


Step 2: Copy and Rename a Base Template

  1. Go to: htdocs/core/modules/propale/doc/

  2. Choose a base template to copy, e.g. pdf_crabe.modules.php

  3. Make a copy and name it pdf_mycompany.modules.php

  4. Inside the new file, rename the class from class pdf_crabe to class pdf_mycompany

  5. Update internal references to match the new name

  6. Save the file


Step 3: Activate Your Custom Template in the Interface

  1. Log into Dolibarr

  2. Go to Home > Modules > Commercial Proposals

  3. Click Setup

  4. In Available models for PDF generation, find mycompany

  5. Click Activate and set it as Default if needed


Step 4: Customize the Layout

Your custom file is a PHP script using FPDF functions. Key areas:

  • Header: logo, title, company info

  • Customer Info: recipient’s name, address

  • Table: items, descriptions, prices

  • Totals: tax, subtotal, grand total

  • Footer: payment terms, legal info, contact

Use $pdf->SetXY, $pdf->MultiCell, etc., to format positions and text.


Step 5: Add Custom Fields or Variables

If you’ve created extra fields (e.g. project_code), fetch them with:

php
$project_code = $object->array_options['options_project_code'];

Insert them in the document as needed using $pdf->MultiCell().


Step 6: Test Your Template

  1. Create or open a quote

  2. Generate PDF using your new template

  3. Check formatting, accuracy, layout, and visibility

  4. Adjust code if needed


Step 7: Maintain Compatibility Across Versions

  • Do not edit core templates directly

  • Use version control

  • After Dolibarr upgrades, review your custom template against updated system files


Advanced Tips

  • Images: Add watermarks or background images

  • Conditions: Show/hide sections based on quote content

  • Translations: Use $langs->trans() to support multiple languages


Common Mistakes

  • Editing default files

  • Mismatched file and class names

  • Forgetting to activate the template

  • Hardcoded values

  • Ignoring spacing or alignment issues


When to Use a Module Instead

If your needs go beyond layout—like logic, integrations, or external data—consider building a full Dolibarr module instead of using PDF templates alone.


Conclusion

A custom quote template gives your business a professional, branded, and functional communication tool. With this guide, you can:

  • Build and activate a custom quote template

  • Insert custom fields and brand elements

  • Maintain and upgrade templates safely

  • Provide clients with polished, accurate documents

By investing a little time in customization, you gain long-term efficiency and branding consistency in your quoting process.

Comments

Log in or register to post comments