Availability |
Odoo Online
Odoo.sh
On Premise
|
Lines of code | 1108 |
Technical Name |
merge_docx |
License | OPL-1 |
Website | http://www.buildfish.com/ |
Versions | 12.0 13.0 14.0 15.0 16.0 17.0 18.0 |
Is Easy an elegant and scalable solution to design reports using Microsoft Office.
Export data all objects odoo to Microsoft Office. output files docx, pdf
Report template *.docx

Out report DOCX or PDF

Word Merge Fields
In order for docx-mailmerge to work correctly, you need to create a standard Word document and define the appropriate merge fields. The examples below are for Word 2010. Other versions of Word should be similar. It actually took me a while to figure out this process but once you do it a couple of times, it is pretty simple.
Start Word and create the basic document structure. Then place the cursor in the location where the merged data should be inserted and choose Insert -> Quick Parts -> Field..:

From the Field dialog box, select the “MergeField” option from the Field Names list. In the Field Name, enter the name you want for the field. In this case, we are using o.name.

Once you click ok, you should see something like this: <<o.name>> in the Word document. You can go ahead and create the document with all the needed fields.
Example create report
Settings/Technical/Reporting/Reporting

Multi docs in one file docx

Multi docs in one file pdf

Config merge report pdfs

Cover template docx

Merge report pdfs

Now with preview of the document PDF

Preview report
http://localhost:8069/report/docx_to_x/template_name/id

Note
- Not insert image in report
- In action merge not insert fields values in header & footer report
- If the module is installed in a windows operating system, the output report will not convert into pdf
- This module has been tested in Community Version
- Does not work with if statement
Help with Python expressions
Help with Python expressions
Various fields may use Python code or Python expressions. The following variables can be used:
env
: Odoo Environment on which the action is triggeredo
: record on which the action is triggered; may be be void (o.* record extend Odoo for report template docx)record
: record on which the action is triggered; may be be voiduser
: Record user logincompany_id
: Record company user logintime
,datetime
,dateutil
,timezone
: useful Python libraries
Example of Python code
record.name + '_code'
Widgets prefix bf_field (Apply field type)
Field type | bf_* | Out (Example) |
---|---|---|
Many2many | o.partner_id.bf_category_id | Services, Consulting Services |
References
- Manual videos: https://bit.ly/3KSWfbs
- Documentation PDF: https://bit.ly/33QVZsH
Global Values & Icons
Attr | Description | Out (Example) |
---|---|---|
env | Environment | |
user | Record res.users | Defined by the user |
company_id | Record res.company | Defined by the user |
lang | Lang user login | es |
time | Function time | |
date | Function date | |
company_vat_label | Company vat label | TIN (Default TIN) |
company_vat_label_full | Concatenate Vat label + vat | TIN: 32412423423 |
company_display_address |
Field company.partner_id.display_address with format LibreOffice |
YourCompany 1725 Slough Ave. Scranton PA 18540 United States |
company_name | Company name | YourCompany |
company_footer_line | Initials line dates & separate per tab. | P. +1 555 123 8069 E. info@example.com W. http://www.example.com TIN: 32412423423 |
company_footer_line_break | Initials dates & line break |
P. +1 555 123 8069 E. info@example.com W. http://www.example.com TIN: 32412423423 |
company_footer_line_icon | Line dates icons & separate per tab | 📞 +1 555 123 8069 ✉ info@example.com 🌐 http://www.example.com TIN: 32412423423 |
company_footer_line_break_icon | Icons dates & line break |
📞 +1 555 123 8069 ✉ info@example.com 🌐 http://www.example.com TIN: 32412423423 |
company_header | Company Tagline with format LibreOffice line break | Header Company |
company_footer | Report Footer with format LibreOffice line break | Footer Company |
iphone | Icon phone | 📞 |
imobile | Icon mobile | 📱 |
iemail | Icon email | ✉ |
iwebsite | Icon website | 🌐 |
imoney | Icon money | 💰 |
idolar | Icon dolar | 💵 |
ilabel | Icon label | 🏷 |
inote | Icon note | 🗈 |
iimg | Icon image | 🖵 |
ilist | Icon list | ☰ |
iqty | Icon qty | ☷ |
ipushpin | Icon pushpin | 📌 |
ioffice | Icon office | 🏢 |
Extra fields in res.partner
Field name | Type field | Description | Out example |
---|---|---|---|
display_address | Text | Call function _display_address() |
China Export ChinaShanghai52 Chop Suey street 200000 |
display_address_without_company | Text | Without company | ChinaShanghai52 Chop Suey street 200000 |
display_address_without_company_line | Text | Without company inline separate per | | ChinaShanghai52 Chop Suey street 200000 |
vat_label | Char | Vat label (Default TIN label) | TIN |
vat_label_full | Char | Concatenate vat label + vat number | TIN: 32412423423 |
data_line | Text | Line data initials | P. +86 21 6484 5671 E. chinaexport@exm.com W. http://www.chinaexport.com/ |
data_line_break | Text | Line break data initials |
P. +86 21 6484 5671 E. chinaexport@exm.com W. http://www.chinaexport.com/ |
data_line_icon | Text | Line data icons | 📞 +86 21 6484 5671 ✉ chinaexport@exm.com 🌐 http://www.chinaexport.com/ |
data_line_break_icon | Text | Line break data icons |
📞 +86 21 6484 5671 ✉ chinaexport@exm.com 🌐 http://www.chinaexport.com/ |
data_line_abbr | Text | Line data abbreviation | Tel: +86 21 6484 5671 Mail: chinaexport@exm.com Web: http://www.chinaexport.com/ |
data_line_break_abbr | Text | Line break data abbreviation |
Tel: +86 21 6484 5671 Mail: chinaexport@exm.com Web: http://www.chinaexport.com/ |
Extra fields in res.company
Field name | Type field | Description | Out example |
---|---|---|---|
display_address | Text | Call function _display_address() |
China Export ChinaShanghai52 Chop Suey street 200000 |
display_address_without_company | Text | Without company | ChinaShanghai52 Chop Suey street 200000 |
display_address_without_company_line | Text | Without company inline separate per | | ChinaShanghai52 Chop Suey street 200000 |
vat_label | Char | Vat label (Default TIN label) | TIN |
vat_label_full | Char | Concatenate vat label + vat number | TIN: 32412423423 |
footer_line | Text | Line data initials | P. +86 21 6484 5671 E. chinaexport@exm.com W. http://www.chinaexport.com/ |
footer_line_break | Text | Line break data initials |
P. +86 21 6484 5671 E. chinaexport@exm.com W. http://www.chinaexport.com/ |
footer_line_icon | Text | Line data icons | 📞 +86 21 6484 5671 ✉ chinaexport@exm.com 🌐 http://www.chinaexport.com/ |
footer_line_break_icon | Text | Line break data icons |
📞 +86 21 6484 5671 ✉ chinaexport@exm.com 🌐 http://www.chinaexport.com/ |
footer_line_abbr | Text | Line data abbreviation | Tel: +86 21 6484 5671 Mail: chinaexport@exm.com Web: http://www.chinaexport.com/ |
footer_line_break_abbr | Text | Line break data abbreviation |
Tel: +86 21 6484 5671 Mail: chinaexport@exm.com Web: http://www.chinaexport.com/ |
Pre-Installation Requirements (Convert to PDF)
- Unoconv: Convert files to any format that supports Microsoft Office. Website: Unoconv example install ubuntu O.S.
# apt-get install unoconv
Supported output format combinations (Template -> Output):
- odt -> odt
- odt -> pdf
- odt -> doc
- odt -> docx
- odt -> pds
- rtf -> rtf
- docx -> pdf
Note
Fully Supports Odoo Version 13.0 Community
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module