title: QWebException: unexpected EOF while parsing (, line 1) [Odoo/Openerp]
body: <p>I created a custom module that computes total invoice from each customer or supplier payment voucher. It returns an error whenever I call the report.</p>
  
  <pre><code>QWebException: unexpected EOF while parsing (, line 1)
  </code></pre>
  
  <p><strong>module: module_pdc</strong></p>
  
  <p><strong>models/outstanding_pdc.py</strong></p>
  
  <pre><code>from openerp import fields, api, models, exceptions
  from datetime import datetime
  from openerp.tools.translate import _
  import openerp.addons.decimal_precision as dp
  
  class AccountOutstandingPostDatedCheck(models.Model):
      _name = 'account.post.dated.check.outstanding'
      _description = 'Outstanding Receivable'
  
      name = fields.Char(string='Reference No.')    
      is_customer = fields.Boolean('Customers')
      is_supplier = fields.Boolean('Suppliers')    
      outstanding_pdc_line_ids = fields.One2many('account.post.dated.check.outstanding.line', 'outstanding_line_id', 'Outstanding Receivable Line')
  
      @api.model    
      def create(self, values):
          sequence_obj = self.env['ir.sequence']      
          values.update({'name' : sequence_obj.next_by_code('pdc.outstanding.ref')})    
          return super(AccountOutstandingPostDatedCheck,self).create(values)  
  
      @api.multi    
      def check_outstanding_pdc(self):
          customer = self.is_customer
          supplier = self.is_supplier    
  
  
          # Create object classes to access records.   
          account_voucher = self.env['account.voucher']    
          outstanding_pdc_line_ids = self.env['account.post.dated.check.outstanding.line']
  
  
          # Clear the list before execution of the main process:    
          if self.outstanding_pdc_line_ids.ids != []:    
              self.outstanding_pdc_line_ids.unlink()
  
          #Search the voucher within the selected period    
          date_today = datetime.now().date()    
          date_today = date_today.strftime("%Y-%m-%d")
  
          pdc_vouchers = []
          if customer and supplier:    
              raise exceptions.ValidationError(_('Select only one partner.'))    
          if not customer and not supplier:    
              raise exceptions.ValidationError(_('Select one partner.'))
          elif customer:    
              pdc_vouchers = account_voucher.search([('post_dated', '=', True), ('state','=','posted'), ('partner_id.customer', '=', True), ('payment_details.type', '=', 'check'), ('payment_details.date_due', '&gt;', date_today)])   
          elif supplier:   
              pdc_vouchers = account_voucher.search([('post_dated', '=', True), ('state','=','posted'), ('partner_id.supplier', '=', True), ('payment_details.type', '=', 'check'), ('payment_details.date_due', '&gt;', date_today)])    
  
          # Loop through each Voucher and collect its Partner Ids.    
          partners = []    
          for voucher in pdc_vouchers:    
              if voucher.partner_id not in partners: partners.append(voucher.partner_id)
          receivable = 0.00
          envelope = 0.00    
          pdc = 0.00
  
          for partner in partners:   
              for pdc_voucher in pdc_vouchers:    
                  if pdc_voucher.partner_id == partner:    
                      for voucher_line in pdc_voucher.line_ids:    
                          receivable += voucher_line.amount_original    
                          if not voucher_line.move_line_id.invoice.reconciled:    
                              envelope += voucher_line.move_line_id.invoice.residual                       
  
                      pdc = receivable - envelope 
                  vals = {  
                      'outstanding_line_id' : self.ids[0],   
                      'partner_id': partner.id,    
                      'receivable': receivable,   
                      'pdc':  pdc,    
                      'envelope': envelope    
                  }   
  
              receivable = 0.00    
              envelope = 0.00    
              pdc = 0.00   
              outstanding_pdc_line_ids.create(vals)
  
  
  
  class AccountPostDatedCheckOutstandingLine(models.Model): 
      _name = "account.post.dated.check.outstanding.line"  
      _description = "Outstanding Receivable Line"  
  
  
      outstanding_line_id = fields.Many2one('account.post.dated.check.outstanding', 'Outstanding Receivable Line')    
      partner_id = fields.Many2one('res.partner', 'Partner')    
      receivable = fields.Float('Receivable')    
      pdc= fields.Float('PDC')    
      envelope = fields.Float('Envelope')
  </code></pre>
  
  <p><strong>views/report_outstanding_pdc.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;openerp&gt;    
  &lt;data&gt;    
  &lt;template id="report_outstanding_pdc_document"&gt;   
      &lt;t t-call="report.html_container"&gt;    
          &lt;t t-foreach="docs" t-as="o"&gt;    
              &lt;t t-call="module_pdc.outstanding_pdc_layout"&gt;    
                  &lt;div class="page"&gt;
                      &lt;table class="table table-condensed"&gt;    
                          &lt;thead&gt;    
                              &lt;tr&gt;   
                                  &lt;th class="col-xs-3"&gt;Name&lt;/th&gt;   
                                  &lt;th class="col-xs-3"&gt;Receivable&lt;/th&gt;   
                                  &lt;th class="col-xs-3"&gt;PDC&lt;/th&gt;  
                                  &lt;th class="col-xs-3"&gt;Envelope&lt;/th&gt;  
                              &lt;/tr&gt;   
                          &lt;/thead&gt;   
  
                          &lt;tr t-foreach="o.outstanding_pdc_line_ids" t-as="or"&gt;  
                              &lt;td class="col-xs-3"&gt;  
                                  &lt;span t-field="or.partner_id"/&gt;    
                              &lt;/td&gt;
  
                              &lt;td class="col-xs-3"&gt;    
                                  &lt;span t-field="or.receivable"/&gt;    
                              &lt;/td&gt;
  
                              &lt;td class="col-xs-3"&gt;   
                                  &lt;span t-field="or.pdc"/&gt;   
                              &lt;/td&gt;
  
                              &lt;td class="col-xs-3"&gt;   
                                  &lt;span t-field="or.envelope"/&gt;  
                              &lt;/td&gt;   
                          &lt;/tr&gt;
  
                          &lt;t t-set="rec" t-value="0.00"/&gt;   
                              &lt;t t-foreach="o.outstanding_pdc_line_ids" t-as="r"&gt;  
                              &lt;t t-set="rec" t-value="rec+r.receivable"/&gt;     
                              &lt;/t&gt; 
  
                          &lt;t t-set="pd" t-value="0.00"/&gt;     
                              &lt;t t-foreach="o.outstanding_pdc_line_ids" t-as="p"&gt;   
                                  &lt;t t-set="pd" t-value="pd+p.pdc"/&gt;    
                              &lt;/t&gt;
  
                          &lt;t t-set="env" t-value="0.00"/&gt;     
                              &lt;t t-foreach="o.outstanding_pdc_line_ids" t-as="e"&gt;  
                                  &lt;t t-set="env" t-value="env+e.envelope"/&gt;    
                              &lt;/t&gt; 
  
                          &lt;tr&gt;    
                                &lt;th class="col-xs-3"&gt;&lt;strong&gt;Total:&lt;/strong&gt;&lt;/th&gt;    
                                &lt;th class="col-xs-3" t-esc="rec"/&gt;    
                                &lt;th class="col-xs-3" t-esc="pd"/&gt;    
                                &lt;th class="col-xs-3" t-esc="env"/&gt;     
                          &lt;/tr&gt;    
                      &lt;/table&gt;        
                  &lt;/div&gt;    
              &lt;/t&gt;
          &lt;/t&gt;    
      &lt;/t&gt;    
  &lt;/template&gt;    
  &lt;/data&gt;    
  &lt;/openerp&gt;
  </code></pre>