Odoo Help


How to pass data to template - formatting problem

Dr Obx
on 1/17/16, 5:14 PM 928 views

How to pass data into template with some formatting elements ?


my template:

<?xml version="1.0" encoding="utf-8"?>


<data noupdate="0">

<record id="stock_check_m" model="email.template">

<field name="name">A_product_multi</field>

<field name="email_from">odoo@odoo.com</field>

<field name="subject">Order</field>

<field name="model_id" ref="iProdLoc.model_stock_check"/>

<field name="email_to" >rob@net.net</field>

<field name="partner_to"></field>

<field name="auto_delete" eval="False"/>

<field name="body_html">



span.oe_mail_footer_access {





.red {

color: #FF0000;



<field name="email_body"/>

<div style="padding: 10px; width:100%; font-size: 40px; height: 80px;top: 0px; color:#FFFFFF; background-color: #2EA2D2; margin-left: auto;margin-right: auto;">

<h1>GNG Computers</h1></div>

<div style="height: auto;margin-left:12px;margin-top:30px;">

<p class="red">Product/s must be ordered/purchased immediately</p>${object.emailbody}

<p>U R G E N T !</p>





module generate some data but I can't add it into template ...

my data:

# loop create/appending data into string

for pop in email:

product = self.pool.get('product.product').browse(cr, uid, pop['product_id'])

product_line = """ Product Name: %s <br/>"""%(product.name)

body += """<div>%s</div> <br/>""" %(product_line)

pr = obj.write({'emailbody':body})

#sending email

self.multi(cr, uid, ids, context=context)

How to pass this string/data into template with all formatting tags ?

I would like to put there a table for example ......

table = """  <table> <tr><td>something</td></tr> <tr><td>something</td></tr> <tr><td>something</td></tr> <tr><td>something</td></tr> <tr><td>something</td></tr> <tr><td>something</td></tr> <tr><td>something</td></tr> </table>"""

Is it possible ?

Or maybe I have to change whole template?

Please help

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: 1/17/16, 5:14 PM
Seen: 928 times
Last updated: 8/20/17, 5:41 AM