Odoo Help


webkit line returns for text fields

Kevin McMenamin
on 4/11/13, 6:12 PM 3,851 views

I have a notes field with a type of text.

On the screen I enter: Note1 Note2 Note3

On the report it comes out as Note1 Note2 Note3

How can I get the line return to be honored in the printed output

Interesting that my formatting of Note1 Note2 and Note3 has been lost. There should be CR between each so they appear on 3 subsequent lines

Solnet Solutions Limited, Kevin McMenamin
on 4/11/13, 6:13 PM

Please upvote if the right answer was provided

Paul Catinean
on 10/7/13, 7:06 AM
Torsten Francke
On 9/18/13, 10:29 AM

${note | carriage_returns} is what you looking for


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

at the start of the document

That does not work for me on a regular text-field, am I missing something?

Paul Catinean
on 10/7/13, 6:43 AM

sorry i should post the complete solution

initOS GmbH, Torsten Francke
on 10/8/13, 7:40 AM

Ah I thought it was a default function, nice Markus

Paul Catinean
on 10/8/13, 7:44 AM

It is a default function on rml-reports so i was confused the first time, but now we are fine

initOS GmbH, Torsten Francke
on 10/8/13, 8:59 AM
Paul Catinean
On 9/18/13, 8:47 AM

Hello Kevin,

The formatting from the text field does not transfer to html (what you should use inside the mako)

A good workaround for this solution is to use the <pre> tag and place o.notes inside it

Do not forget to reset the style on the pre tag or simply just change the font to the one you use

Another would be to add in the mako ${o.field.replace('\n','<br />').replace('\r\n', '<br />')} this will substitute the newline/return carriage + newline into breaks

Hope this helps you!


Grover Menacho

--Grover Menacho--
| 5 7 8
La Paz, Bolivia
--Grover Menacho--

Odoo Developer

Grover Menacho
On 10/8/13, 10:53 AM

Why don't you use fields.html ? It's much better to customize your text to be printed.

'note': fields.html('Note')

Not changing existing fields, only print right in webkit reports

initOS GmbH, Torsten Francke
on 10/8/13, 11:24 AM

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

0 follower(s)


Asked: 4/11/13, 6:12 PM
Seen: 3851 times
Last updated: 3/16/15, 8:10 AM