使用OpenERP 7的Webkit报告未显示模块的继承字段?

时间:2014-06-20 06:38:43

标签: webkit report reporting openerp openerp-7

我正在尝试在OpenERP中生成报告。我从net获得了这个想法,用于使用Webkit生成报告,我按照link进行webkit配置,

也许这个链接现在没有运行,但我昨天使用它确实有效。

最后我们在webkit模板中粘贴了一些代码,

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

我们打印一些值,

 ${ o.id }
            Provision Name is ${ o.name }
            Deadline Date is ${ o.deadline_date }
            ${ o.state }

它的工作正常,它是该特定模块的打印值,但我还继承了该模块中其他模块的一些字段,我打印报告它不打印那些继承的字段,也没有给出任何错误。

希望您的建议如何打印模块的继承字段

0 个答案:

没有答案