vendredi 22 mai 2009

Html Reports Using Mako Templates

Hello Every One,

Now you can create your HTML reports using Mako Templates for faster and formatted output.Open ERP has added new type of report called mako2html.

Mako is a template library written in Python. It provides a familiar, non-XML syntax which compiles into Python modules for maximum performance. This enables end user to make changes in format of report easily and faster as per her need.


1. Fast: simple three-sectioned layout mako template report takes 1.10 ms
2. Control structures constructed from real Python code (i.e. loops, conditionals) Which will allow user to create reports faster.
3. Straight Python blocks, inline or at the module-level

You can format the report as you need using HTML.


Mako 0.2.4 should be installed on your system.
openERP-server : Trunk version
openERP-client : Trunk version
openERP-addons : Trunk version

As an overview lets see a small example,

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<%include file=”mako_header.html”/>
% for o in objects:
<div style=”white-space: nowrap; float: left;”>
<p><small><b>Shipping address :</b></small></br></p>
<small>${ o.partner_id.title or ‘ ‘ } ${ }</small></br>
<small>${ o.partner_shipping_id.title or ‘ ‘ } ${ }</small></br>
<small>${ o.partner_shipping_id.street }</small></br>
<small>${ o.partner_shipping_id.street2 or ‘ ‘ }</small></br></address>

% endfor
<%include file=”mako_footer.html”/>

for your company header you need to include <%include file=”mako_header.html”/>
for your company footer you need to include <%include file=”mako_footer.html”/>
This files will bring the header and footer that you have defined for your company in the database.

Sale Order

For Complete Example of Sale_order please Refer the module sale_report_html from :

Thanks & regards

Open ERP team

21 commentaires:

  1. Great post! I’m searching for this information for long time and I have found it here. I’m a lucky man and honestly It’ really important to me. Very smart, thanks for kindly sharing it with us. Very well done indeed. If you do not mind, please visit my article related to pandeglang district in Banten, Indonesia at Kenali dan Kunjungi Objek Wisata di Pandeglang or Kenali dan Kunjungi Objek Wisata di Pandeglang and information about district Banten Indonesia Banten dan Kabupaten Pandeglang

  2. Interesting post. I have been wondering about this issue,so thanks for posting. I’ll likely be coming back to your blog. Keep up great writing.

    Travel News | Free Song Lyric | A Love to Kill | Learn Indonesia Language | cari rumah | jual rumah | rumah dijual | Laptop Price List | New Blackberry | Health & Jewerly

  3. I don’t know If I said it already, but this so good stuff keep up the good work. I read a lot of blogs on a daily basis and for the most part Belajar seo blogspot just wanted to make a quick comment to say I’m glad I found your blog. Thanks.

    Best regards
    Seo Motivation Oes tsetnoc faq

  4. Ce commentaire a été supprimé par l'auteur.

  5. Hi,
    this is exactly what i need, importing header and footer from separate file..
    but i am getting an exception:

    (raise exceptions.TemplateLookupException("Template '%s' has no TemplateLookup associated" %)

    any kind of help will be useful
    waiting for response

  6. Actually have a very nice blog, I wish I could see everything you have all the time, I'm really entertained by your comments, and best wishes for your blog
    Organic vitamins

  7. I’m so glad that I took the time to look at this blog, because let me tell you. Not a lot of people know how to balance knowledge of a subject and content Free Classified Ads.

  8. Impressive review and Important topic of discussion. I accept it is all research work, will be back to check other articles.

    Buy a Logo

  9. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts.

    small business social media optimization

  10. Thanks for the informative writing. Would mind updating some good tips about it. I still wait your next place. ;)

    Buy A Ready-Made Logo

  11. Nice post, I really apprecialte the way you are sharing your experiences.
    CCTV Systems

  12. Its really helpfull and informative Way of explanation. Please also consider visiting my site, I will be glad if I could be helpful for you.
    Business Coach

  13. Thanks for the wonderful article, it is very appreciateable.
    Phlebotomy Courses

  14. great resource it helps to use optimized coding which is seo friendly. Facebook Developer Page

  15. I was surfing arround on Google and came across this blog. Some good information in here! I also have a website. Affordable Logo Design - Cheap Logo Design - Custom Logo Design - Small Business Logo Design

  16. Great information, you have a wonderful blog and an excellent article. Logo Design Blog

  17. I really appreciate for the efforts made here. This website I found very informative and I would love to come back here. What about the update activity on twitter so I would stay connected there. Thanks toronto airport

  18. It’s great to see that people are sharing quite profitable information with each other and now we can move ourselves to a new era. cheap term papers

  19. Thanks you so much. This post is very help full for me a lot. Thanks for sharing nice post
    convert psd to wordpresss theme