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 report with OpenERP 7 Inherited fields of module are not displaying?

By
arsalan
on 6/23/14, 5:21 AM 938 views

I am trying to generate report in OpenERP. I got this idea from net for generating report using Webkit, I follow link for webkit configuration,

perhaps this link is not running right now but i used it yesterday it works.

at the end we pasted some code in webkit template that is,

 

<html> 

<head>

       <style type="text/css">

                 ${css}

       </style>

</head>

<body>

<!-- The objects variable is a list of browse_record objects from OpenERP. -->

<!-- It contains all the documents in OpenERP that you wanted to generate this report for. -->

<!-- We loop on it in order to be able to output the information for each document -->

%for o in objects:

<!-- We want to print this report out and send it to the partner, so -->

<!-- We use the partner_id field on our object to set the translation language -->

<% if hasattr(o, 'partner_id'): setLang(o.partner_id.lang) %>

<!-- Now we write the name field of our object as the title -->

<!-- You can access any field or function on the object like this -->

<!-- Notice above we use the same syntax to output the css variable that was given to use by OpenERP? -->

<h1>

        ${ o.id }

        Provision Name is ${ o.name }

       Deadline Date is ${ o.deadline_date }

       ${ o.state }

</h1>

<%

        # Let's define a function to get the day of the week with        Python.

       # Notice the <% and %> to open and close Python                 code blocks...

      # They can also be used for 1 liners (see setLang above)      

    import time  

     def get_day():

     return time.strftime("%A")

%>

<!-- We call our function in the same way as we ouput parameters and it will simply print the result -->

<div style="font-weight: bold">

Happy To u ${ get_day() }!

</div>

<!-- We can even create variables inside Python code blocks and use them later -->

<%

from datetime import datetime

time = datetime.now()

%>

<!-- Here, I use a similar syntax to the for loops to write an if statement --> %if time.hour > 18 and time.hour < 8: Shouldn't you be at home?!

%else:

Keep up the good work! :)

%endif

<!-- Don't forget to close your loops! -->

%endfor

</body>

</html>

We print some values that are ,

${ o.id }

Provision Name is ${ o.name }

Deadline Date is ${ o.deadline_date }

${ o.state }

 

Its working fine it is printing value of that particular module but i also inherited some fields from other modules in this module for which i am printing report it is not printing those inherited fields nor giving any error.

Hopes for your suggestion how to print inherited fields of module

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)

Stats

Asked: 6/23/14, 5:21 AM
Seen: 938 times
Last updated: 3/16/15, 8:10 AM