Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Food & Hospitality
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Guest House
    • Distributor nápojů
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Trades
    • Údržbář
    • IT hardware a podpora
    • Solar Energy Systems
    • Výrobce obuvi
    • Úklidové služby
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

What's the difference between t-esc and t-field in a report ?

Odebírat

Get notified when there's activity on this post

This question has been flagged
qwebt-field
3 Odpovědi
32614 Zobrazení
Avatar
Paraita Wohler

I'm using Odoo 8 and I've inherited account.invoice.line and added a new field:



class account_invoice_line(models.Model):
_inherit = "account.invoice.line"

price_unit_currency = fields.Float('Prix-Unitaire-Devise', store=False, readonly=True,
compute='_compute_pu_currency',
default=0.)

@api.one
def _compute_pu_currency(self):
self.price_unit_currency = line.price_unit * 1.28


In my report, I can print that field (first column) but doesn't show up in the second column:​


<tr t-foreach="o.invoice_line" t-as="l">
<td>
<span t-esc="l.price_unit_currency"/>
</td>
<td>
<span t-field="l.price_unit_currency"/>
</td>
</tr>


When I generate my report, I get this error in the log:

​

2019-12-30 20:09:09,820 329299 WARNING My_Super_Module openerp.addons.base.ir.ir_qweb: Could not get field price_unit_currency for model account.invoice.line


I'd just like to understand why it works with t-esc, and not with t-field. https://www.odoo.com/documentation/8.0/reference/qweb.html didn't really helped me understand the mechanism but I suspect t-field to only work on stored fields, is that the case ? Where can I learn more about that ?

Thanks in advance to the community :)

2
Avatar
Zrušit
Sehrish

Hope this will helps in future: http://learnopenerp.blogspot.com/search/label/Qweb

Avatar
TeqStars Technologies
Nejlepší odpověď

Hello Paraita Wohler,

Let us describe to you in more detail. 

QWeb has a primary output directive which automatically HTML-escape. es​c takes an expression, evaluates it and prints the content.

For example, if you want to get the data from a python dictionary.  

<t t-esc="dict['key']"/>

Simply, t-esc allows you to evaluate code runtime like python code and print it. 

Where t-field directive can only be used when performing field access (Only work on stored fields) and formatting data according to the field type. Also, t-field-options can be used to customize fields. See below example, 

<t-field="o.date" t-field-options='{"widget":"date"'}'/>
5
Avatar
Zrušit
Avatar
alvinadjie
Nejlepší odpověď

Hi,
For computed field if you want to called it in qweb you need to add store=true on your field definition on python file.

if not stored you should use t-esc

t-esc is for running python code on qweb you can call python function doing calculation using t-esc

t-field is for calling field from your model into qweb

1
Avatar
Zrušit
Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Customize document layout Vyřešeno
qweb odoo t-field
Avatar
Avatar
1
dub 22
8118
Odoo 18: Display image from char field containing url in qweb form
qweb
Avatar
Avatar
1
čvc 25
2949
PDF Export Option for QWeb Reports in odoo 17.0
qweb
Avatar
Avatar
1
kvě 25
3705
QWeb: use t-if to check birthday date Vyřešeno
qweb
Avatar
Avatar
1
dub 25
3222
Odoo 17 - QWeb Reports with External Datasource Vyřešeno
qweb
Avatar
Avatar
1
úno 25
2579
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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