Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

QWebException: unexpected EOF while parsing (, line 1)

Subscriure's

Get notified when there's activity on this post

This question has been flagged
qwebvoucherreportqweb-report
1 Respondre
12923 Vistes
Avatar
Anonymous

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.

QWebException: unexpected EOF while parsing (, line 1)

module: module_pdc

models/outstanding_pdc.py


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', '>', 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', '>', 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')


views/report_outstanding_pdc_layout.xml

<?xml version="1.0" encoding="UTF-8" ?>

<openerp>

<data>

<template id="outstanding_pdc_header">

<div class="header">

<div class="row" style="text-align:center;">

<div class="col-xs-12">

<br/>

<h2>Outstanding Receivable</h2>

<t t-if="o.outstanding_pdc_line_ids.partner_id.customer">

<th>(Customers)</th>

</t>

<t t-if="o.outstanding_pdc_line_ids.partner_id.supplier">

<th>(Suppliers)</th>

</t>

</div>

</div>

</div>

</template>

<template id="outstanding_pdc_footer">

<div class="footer">

<div class="row">

<div class="col-xs-5">

<span t-esc="time.strftime('%A, %B %d, %Y')"/>

</div>

<div class="col-xs-3" style="text-right">

<![CDATA[&nbsp;]]>

</div>

<div class="col-xs-1">

<![CDATA[&nbsp;]]>

</div>

<div class="col-xs-3" style="text-right">

Page: <span class="page"/> of <span class="topage"/>

</div>

</div> `

</div>

</template>

<template id="outstanding_pdc_layout">

<t t-call="module_pdc.outstanding_pdc_header"/>

<t t-raw="0"/>

<t t-call="module_pdc.outstanding_pdc_footer"/>

</template>

</data>

</openerp>


views/report_outstanding_pdc.xml

<?xml version="1.0" encoding="utf-8"?>

<openerp>

<data>

<template id="report_outstanding_pdc_document">

<t t-call="report.html_container">

<t t-foreach="docs" t-as="o">

<t t-call="module_pdc.outstanding_pdc_layout">

<div class="page">

<table class="table table-condensed">

<thead>

<tr>

<th class="col-xs-3">Name</th>

<th class="col-xs-3">Receivable</th>

<th class="col-xs-3">PDC</th>

<th class="col-xs-3">Envelope</th>

</tr>

</thead>

<tr t-foreach="o.outstanding_pdc_line_ids" t-as="or">

<td class="col-xs-3">

<span t-field="or.partner_id"/>

</td>

<td class="col-xs-3">

<span t-field="or.receivable"/>

</td>

<td class="col-xs-3">

<span t-field="or.pdc"/>

</td>

<td class="col-xs-3">

<span t-field="or.envelope"/>

</td>

</tr>

<t t-set="rec" t-value="0.00"/>

<t t-foreach="o.outstanding_pdc_line_ids" t-as="r">

<t t-set="rec" t-value="rec+r.receivable"/>

</t>

<t t-set="pd" t-value="0.00"/>

<t t-foreach="o.outstanding_pdc_line_ids" t-as="p">

<t t-set="pd" t-value="pd+p.pdc"/>

</t>

<t t-set="env" t-value="0.00"/>

<t t-foreach="o.outstanding_pdc_line_ids" t-as="e">

<t t-set="env" t-value="env+e.envelope"/>

</t>

<tr>

<th class="col-xs-3"><strong>Total:</strong></th>

<th class="col-xs-3" t-esc="rec"/>

<th class="col-xs-3" t-esc="pd"/>

<th class="col-xs-3" t-esc="env"/>

</tr>

</table>

</div>

</t>

</t>

</t>

</template>

</data>

</openerp>





0
Avatar
Descartar
Avatar
Anonymous
Autor Best Answer

I found what was the problem in my template.

<tr t-foreach="o.outstanding_pdc_line_ids" t-as="or">

Instead of **or**, I used different name for my one2many field.

0
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
ValueError The _name attribute report.test_module.report_test_doc is not valid. [Qweb]
qweb voucher report
Avatar
Avatar
Avatar
2
de des. 18
16081
Report Parser [Qweb]
qweb voucher report
Avatar
0
de març 16
6297
odoo 16 report target new page scss
qweb report
Avatar
Avatar
1
d’abr. 25
2180
Missing external identifier on new external layout template Solved
qweb report
Avatar
Avatar
2
de març 25
2772
Translate month name in t-esc Qweb report Solved
qweb report
Avatar
Avatar
Avatar
Avatar
Avatar
4
de nov. 24
8131
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now