Odoo Help


How to replace carriege return \n or \r or both into html <br> in a qWeb pdf report? (Odoo9)

Andreas Jonderko
on 8/17/16, 2:28 PM 1,302 views

In an sale order we have the possibility to enter some line feeds or carriege return signs. In the preview, you can see it in Odoo, but on the pdf generation, the signs are ignored. 

What i tried is:

<t t-set="temp_name" t-value="temp_name.replace('\n','&#13;')"/>

<t t-esc="temp_name"/>

but this produces an exception:

  File "/home/odoo/src/odoo/9.0/openerp/tools/safe_eval.py", line 296, in safe_eval
    c = test_expr(expr, _SAFE_OPCODES, mode=mode)
  File "/home/odoo/src/odoo/9.0/openerp/tools/safe_eval.py", line 153, in test_expr
    code_obj = compile(expr, "", mode)
QWebException: EOL while scanning string literal (, line 1)

Ray Carnes

--Ray Carnes--
| 9 7 9
Keyport, United States
--Ray Carnes--

Senior ERP Analyst

OpenERP 6.1, 7.0; Odoo 8.0, 9.0, 10.0 and 11.0.

Completed Odoo Functional and Technical Training.

Functional Areas:

  • CRM/Sales

  • Inventory

  • Manufacturing

  • Accounting

  • Purchasing

Major Skills:

  • Business Process Reengineering

  • Efficiency Consulting

  • User Needs and GAP Analysis;

  • Functional and Technical Design;

  • Prototyping and Proof of Concepts;

  • Requirements Specifications;

  • Agile Implementation;

  • Data Migration;

  • Configuration & Customization (UI and code);

  • Integration - Odoo and non Odoo Applications and Services;

  • Training and Knowledge Transfer;

  • Go Live Support;

  • Helpdesk;

  • Version Upgrades and Migration.

  • Accounting Expert.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

I am a skilled Communicator and I only take the serious things seriously!

Ray Carnes
On 8/17/16, 3:45 PM

Have you seen and tried https://www.odoo.com/forum/help-1/question/webkit-line-returns-for-text-fields-11072 ?


${note | carriage_returns} is what you looking for


    def carriage_returns(text):
        return text.replace('\n', '<br />')

at the start of the document

Thank you very much, I tried this, but get also an exception on inserting the definition. Where exactly can I put this definition?

gastronovi GmbH, Andreas Jonderko
on 8/17/16, 3:47 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/17/16, 2:28 PM
Seen: 1302 times
Last updated: 8/18/16, 1:59 AM