Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Qweb comprehension list if date between

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
dateqwebbetweensum
9 Răspunsuri
6034 Vizualizări
Imagine profil
Thomas DUPORT

Hello, i'm in odoo 10 in qweb report

I want to browse my invoices records ( <tr t-foreach="docs" t-as="o">)

and i want to sum the total_amount for all invoices where the date_invoice is in january, then for february etc...

I've tried this:

<t t-set="adquat_janvier" t-value="sum([o.amount_total for o in docs if date_invoice in ('20190101','20190131') ])"/>

But there is the following error 

SyntaxError: unexpected EOF while parsing

Error when compiling AST
SyntaxError: unexpected EOF while parsing (<unknown>, line 0)
Template: 1126
Path: /templates/t/t/t/t[2]
Node: <t t-content="True"/>
​
I've tried this too :
<t t-set="adquat_janvier" t-value="sum([(date_invoice in ('20190101','20190131') and o.amount_total)  for o in docs ])"/>

How can i set debug mode ? (with pdb ?) 

0
Imagine profil
Abandonează
Imagine profil
Thomas DUPORT
Autor Cel mai bun răspuns

Ok so I completely change my method : 

I've done a class and a method to teturn all the data I need :


class ReportCalendrierAdherent(models.AbstractModel):
_name = 'report.adquat_distribinox_report.report_calendrier_adherent'

@api.model
def get_report_values(self, docids, data=None):
    ...
    docargs = {
    'doc_ids': docids,
    'doc_model': 'account.invoice',
    'docs': self.env['account.invoice'].browse(docids),
    'arg_partner': invoices[0].partner_id,
    'arg_lines': lines,
    'arg_line_total': line_total,
    }
    return docargs
0
Imagine profil
Abandonează
Imagine profil
Hilar Andikkadavath
Cel mai bun răspuns

Try this:

<t t-set="adquat_janvier"
t-value="sum([docs.filtered(lambda rec: rec.date_invoice >= datetime.date(2019,1,1) and rec.date_invoice <= datetime.date(2019,1,31)).mapped('amount_total')])"/>
0
Imagine profil
Abandonează
Thomas DUPORT
Autor

Sorry it doesn't whork, this is the error :

Error to render compiling AST

TypeError: unsupported operand type(s) for +: 'int' and 'list'

Template: 1154

Path: /templates/t/t/t/table/tbody/tr/t

Node: <t t-set="adquat_janvier" t-value="sum([docs.filtered(lambda rec: rec.date_invoice in ('20190101','20190131')).mapped('amount_total')])"/>

Hilar Andikkadavath

what are docs here?

Hilar Andikkadavath

you should update rec.date_invoice in ('20190101','20190131') with proper date comparison

Thomas DUPORT
Autor

docs are account.invoices

how can i do proper date comparison please?

Thomas DUPORT
Autor

Do you know if i can do all my treatment in python and return the correct values at qweb at the end ?

Hilar Andikkadavath

for example:

str(datetime.date(2019,1,1)) in ('2019-01-01') or datetime.date(2019,1,1) == date(2019,1,1) or datetime.date(2019,1,1) in [datetime.date(2019,1,1),datetime.date(2019,1,2)]

Hilar Andikkadavath

check my updated answer, maybe you need this.

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

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
QWeb report : calculate number of days late for task deadlines
date qweb
Imagine profil
Imagine profil
Imagine profil
2
oct. 21
8607
Qweb report compare a field date with today date Rezolvat
date qweb report
Imagine profil
Imagine profil
1
feb. 25
2399
how to take purchase order of a partner in between two dates?
date purchase_order between
Imagine profil
0
oct. 24
3101
Problem with date filter BETWEEN two dates
filter date between v18
Imagine profil
Imagine profil
Imagine profil
2
mai 25
2137
How to avoid unicode transformation of my data passed to a report parser? Rezolvat
date qweb format unicode
Imagine profil
Imagine profil
2
feb. 16
6877
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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