title: QWebException: "'NoneType' object is not callable" while evaluating 'has_shortage_so_lines(data)==True'
body: <p>I found the another question at <a href="https://stackoverflow.com/questions/31248272/qwebexception-nonetype-object-is-not-callable-while-evaluating">here</a>. But there is no answer. </p>
  
  <p>I got the error </p>
  
  <pre><code>QWebException: "'NoneType' object is not callable" while evaluating 'has_shortage_so_lines(data)==True'
  </code></pre>
  
  <p>This is my report_view.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;openerp&gt;
    &lt;data&gt;
      &lt;!-- External Consumption Report --&gt;
      &lt;!-- Landscape Paper Format--&gt;
      &lt;record id="paperformat_LetterLandscape" model="report.paperformat"&gt;
        &lt;field name="name"&gt;US Letter Landscape&lt;/field&gt;
        &lt;field name="default" eval="True"/&gt;
        &lt;field name="format"&gt;Letter&lt;/field&gt;
        &lt;field name="page_height"&gt;0&lt;/field&gt;
        &lt;field name="page_width"&gt;0&lt;/field&gt;
        &lt;field name="orientation"&gt;Landscape&lt;/field&gt;
        &lt;field name="margin_top"&gt;15&lt;/field&gt;
        &lt;field name="margin_bottom"&gt;15&lt;/field&gt;
        &lt;field name="margin_left"&gt;2&lt;/field&gt;
        &lt;field name="margin_right"&gt;2&lt;/field&gt;
        &lt;field name="header_line" eval="False"/&gt;
        &lt;field name="header_spacing"&gt;7&lt;/field&gt;
        &lt;field name="dpi"&gt;100&lt;/field&gt;
      &lt;/record&gt;
      &lt;!--Report XLS--&gt;
      &lt;report
          id="action_report_shortage_xls"
          model="sale.order"
          string="Shortage Report"
          report_type="qweb-html"
          name="sale.report_shortage_xls"
          file="sale.report_shortage_xls"/&gt;
      &lt;!--Paper Format to shortage report--&gt;
      &lt;record id="action_report_shortage_xls" model="ir.actions.report.xml"&gt;
        &lt;field name="paperformat_id" ref="stock.paperformat_LetterLandscape"/&gt;
      &lt;/record&gt;
    &lt;/data&gt;
  &lt;/openerp&gt;
  </code></pre>
  
  <p>This is my report_xls.xml </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;openerp&gt;
    &lt;data&gt;
    &lt;!-- Translatable template --&gt;
      &lt;template id="report_shortage_xls"&gt;
        &lt;div class="workbook"&gt;
          &lt;div class="worksheet" name="Shortage Report"&gt;
            &lt;table&gt;
              &lt;tbody&gt;
                &lt;tr&gt;
                  &lt;td easyfx="font: height 200;align: horizontal left,vert center"&gt;Printed On :&lt;/td&gt;
                  &lt;td&gt;&lt;span t-usertime="%d-%m-%Y %H:%M" /&gt;&lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                &lt;/tr&gt;
              &lt;/tbody&gt;
            &lt;/table&gt;
            &lt;table&gt;
            &lt;thead&gt;
              &lt;tr&gt;
                &lt;th colspan="17" easyfx="font: height 400, bold on;align: horizontal center,vert center"&gt;Shortage Report&lt;/th&gt;
              &lt;/tr&gt;
              &lt;!--&lt;tr&gt;
                &lt;th&gt;
                  &lt;span t-esc="has_shortage_so_lines(o.id)"/&gt;
                &lt;/th&gt;
              &lt;/tr&gt;--&gt;
            &lt;/thead&gt;
          &lt;/table&gt;
          &lt;t t-if="has_shortage_so_lines(data)==True"&gt;
            &lt;table&gt;
              &lt;thead&gt;
                &lt;tr&gt;
                  &lt;th easyfx="font:height 200, bold on;align: horizontal center,vert center;"&gt;Date&lt;/th&gt;
                  &lt;th easyfx="font:height 200, bold on;align: horizontal center,vert center;"&gt;SO No&lt;/th&gt;
                  &lt;th easyfx="font:height 200, bold on;align: horizontal center,vert center;"&gt;Customer Ref No&lt;/th&gt;
                &lt;/tr&gt;
              &lt;/thead&gt;
            &lt;/table&gt;
          &lt;/t&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/template&gt;
    &lt;!-- Main template --&gt;
    &lt;template id="xls_report_shortage"&gt;
      &lt;t t-call="report.html_container"&gt;
        &lt;t t-foreach="doc_ids" t-as="doc_id"&gt;
          &lt;t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'sale.report_shortage_xls')"/&gt;
         &lt;/t&gt;
        &lt;/t&gt;
      &lt;/template&gt;
    &lt;/data&gt;
  &lt;/openerp&gt;
  </code></pre>
  
  <p>This is my report.py</p>
  
  <pre><code>class ShortageReport(report_sxw.rml_parse):
      def __init__(self, cr, uid, name, context):
          super(ShortageReport, self).__init__(cr, uid, name, context=context)
          self.localcontext.update({
              'get_date_from': self.get_date_from,
              'get_date_to': self.get_date_to,
              'has_shortage_so_lines': self.has_shortage_so_lines,
              'get_shortage_lines': self.get_shortage_lines,
          })
      def has_shortage_so_lines(self, order_id):
          _logger.info("sale order id &gt;&gt;&gt; : %r", order_id)
          lines_obj = self.get_shortage_so_lines(order_id)
          if lines_obj:
              return True
          return False
  
  class report_shortage_xls(osv.AbstractModel):#(models.AbstractModel):
      _name = 'report.stock.report_shortage_xls'
      _inherit = 'report.abstract_report'
      _template = 'stock.report_shortage_xls'
      _wrapped_report_class = ShortageReport
  </code></pre>
  
  <p>Is there any way to export the xls from odoo. Thank you so much for your helping.</p>