Odoo Help

Welcome!

This community 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.

0

webkit line returns for text fields

By
Kevin McMenamin
on 4/11/13, 6:12 PM 2,528 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
1
Torsten Francke
On 9/18/13, 10:29 AM

${note | carriage_returns} is what you looking for

with:

    <%
    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
0

Grover Menacho

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

Systems Engineer + MBA

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
0
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!

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

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