Odoo Help


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.


How to pass data to template - formatting problem

Dr Obx
on 1/17/16, 5:14 PM 423 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

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

1 follower(s)


Asked: 1/17/16, 5:14 PM
Seen: 423 times
Last updated: 1/18/16, 4:11 AM