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.

Advantages:

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.

Requirements:

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”>
<html>
<head>
<%include file=”mako_header.html”/>
</head>
<body>
% for o in objects:
<div style=”white-space: nowrap; float: left;”>
<address>
<p><small><b>Shipping address :</b></small></br></p>
<small>${ o.partner_id.title or ‘ ‘ } ${ o.partner_id.name }</small></br>
<small>${ o.partner_shipping_id.title or ‘ ‘ } ${ o.partner_shipping_id.name }</small></br>
<small>${ o.partner_shipping_id.street }</small></br>
<small>${ o.partner_shipping_id.street2 or ‘ ‘ }</small></br></address>
</div>

% endfor
</body>
<%include file=”mako_footer.html”/>
</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 : https://code.launchpad.net/~openerp-community/openobject-addons/trunk-addons-community

Thanks & regards

Open ERP team

16 commentaires:

  1. 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

    RépondreSupprimer
  2. Ce commentaire a été supprimé par l'auteur.

    RépondreSupprimer
  3. 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
    Rohail

    RépondreSupprimer
  4. 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

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

    Buy a Logo

    RépondreSupprimer
  6. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts.

    small business social media optimization

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

    Buy A Ready-Made Logo

    RépondreSupprimer
  8. Nice post, I really apprecialte the way you are sharing your experiences.
    CCTV Systems

    RépondreSupprimer
  9. Thanks for the wonderful article, it is very appreciateable.
    Phlebotomy
    Phlebotomy Courses

    RépondreSupprimer
  10. great resource it helps to use optimized coding which is seo friendly. Facebook Developer Page

    RépondreSupprimer
  11. 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

    RépondreSupprimer
  12. 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

    RépondreSupprimer
  13. 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

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

    RépondreSupprimer