Template Report DOCX

by
Odoo

58.48

v 16.0 Third Party 84
Live Preview
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 1127
Technical Name merge_docx
LicenseOPL-1
Websitehttp://www.build-fish.com/
Versions 17.0 14.0 12.0 13.0 16.0 15.0
You bought this module and need support? Click here!
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 1127
Technical Name merge_docx
LicenseOPL-1
Websitehttp://www.build-fish.com/
Versions 17.0 14.0 12.0 13.0 16.0 15.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/pdf/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 triggered
  • o: 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 void
  • user: Record user login
  • company_id: Record company user login
  • time, 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/

Contact us for support, consultation, customization

Contact by email

david.2964.erls@gmail.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 16.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

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author or have a question related to your purchase, please use the support page.
There are no ratings yet!
Version 15
by
jeffry@astratech.com.do
on 5/11/23, 12:43 AM

RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/tools/safe_eval.py", line 332, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "", line 1, in
NameError: name 'Nombre' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/mnt/extra-addons/modulo15/merge_docx/controllers/main.py", line 56, in report_download
response = self.report_routes(reportname, docids=docids, converter=None, context=context)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 535, in response_wrap
response = f(*args, **kw)
File "/mnt/extra-addons/modulo15/merge_docx/controllers/main.py", line 32, in report_routes
mimetype, out, report_name, ext = report.with_context(context).render_any_docs(docids, data=data)
File "/mnt/extra-addons/modulo15/merge_docx/models/report.py", line 441, in render_any_docs
data = self.docx_values(doc.with_context(lang=lang), fields_template)
File "/mnt/extra-addons/modulo15/merge_docx/models/report.py", line 359, in docx_values
data.update({exp: safe_eval(exp, eval_context)})
File "/usr/lib/python3/dist-packages/odoo/tools/safe_eval.py", line 348, in safe_eval
raise ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr))
ValueError: : "
Tname 'Nombre' is not defined" while evaluating
'Nombre'


This sssa


Error v15
by
jeffry@astratech.com.do
on 5/11/23, 12:42 AM

RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/tools/safe_eval.py", line 332, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "", line 1, in
NameError: name 'Nombre' is not defined



Error Michel Jackson

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/mnt/extra-addons/modulo15/merge_docx/controllers/main.py", line 56, in report_download
response = self.report_routes(reportname, docids=docids, converter=None, context=context)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 535, in response_wrap
response = f(*args, **kw)
File "/mnt/extra-addons/modulo15/merge_docx/controllers/main.py", line 32, in report_routes
mimetype, out, report_name, ext = report.with_context(context).render_any_docs(docids, data=data)
File "/mnt/extra-addons/modulo15/merge_docx/models/report.py", line 441, in render_any_docs
data = self.docx_values(doc.with_context(lang=lang), fields_template)
File "/mnt/extra-addons/modulo15/merge_docx/models/report.py", line 359, in docx_values
data.update({exp: safe_eval(exp, eval_context)})
File "/usr/lib/python3/dist-packages/odoo/tools/safe_eval.py", line 348, in safe_eval
raise ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr))
ValueError: : "name 'Nombre' is not defined" while evaluating
'Nombre'


Error v15
by
jeffry@astratech.com.do
on 5/11/23, 12:41 AM

 RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/tools/safe_eval.py", line 332, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "", line 1, in
NameError: name 'Nombre' is not defined



During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/mnt/extra-addons/modulo15/merge_docx/controllers/main.py", line 56, in report_download
response = self.report_routes(reportname, docids=docids, converter=None, context=context)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 535, in response_wrap
response = f(*args, **kw)
File "/mnt/extra-addons/modulo15/merge_docx/controllers/main.py", line 32, in report_routes
mimetype, out, report_name, ext = report.with_context(context).render_any_docs(docids, data=data)
File "/mnt/extra-addons/modulo15/merge_docx/models/report.py", line 441, in render_any_docs
data = self.docx_values(doc.with_context(lang=lang), fields_template)
File "/mnt/extra-addons/modulo15/merge_docx/models/report.py", line 359, in docx_values
data.update({exp: safe_eval(exp, eval_context)})
File "/usr/lib/python3/dist-packages/odoo/tools/safe_eval.py", line 348, in safe_eval
raise ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr))
ValueError: : "name 'Nombre' is not defined" while evaluating
'Nombre'


Interested in purchasing app
by
Kikvadze George
on 5/6/23, 9:06 AM

Hello,
I'm George, and I'm interested in your product I need a demo environment for testing this app.
https://apps.odoo.com/apps/modules/16.0/merge_docx/
Contact me at Email: giorgi@leansystems.ge