Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

Qweb comprehension list if date between

Odoberať

Get notified when there's activity on this post

This question has been flagged
dateqwebbetweensum
9 Replies
6033 Zobrazenia
Avatar
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
Avatar
Zrušiť
Avatar
Thomas DUPORT
Autor Best Answer

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
Avatar
Zrušiť
Avatar
Hilar Andikkadavath
Best Answer

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
Avatar
Zrušiť
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!

Registrácia
Related Posts Replies Zobrazenia Aktivita
QWeb report : calculate number of days late for task deadlines
date qweb
Avatar
Avatar
Avatar
2
okt 21
8607
Qweb report compare a field date with today date Solved
date qweb report
Avatar
Avatar
1
feb 25
2398
how to take purchase order of a partner in between two dates?
date purchase_order between
Avatar
0
okt 24
3101
Problem with date filter BETWEEN two dates
filter date between v18
Avatar
Avatar
Avatar
2
máj 25
2136
How to avoid unicode transformation of my data passed to a report parser? Solved
date qweb format unicode
Avatar
Avatar
2
feb 16
6877
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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