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
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • 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
    Others
    • 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
  • Help

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

V14 t-if with custom selection field

Odoberať

Get notified when there's activity on this post

This question has been flagged
selectiont-ifv14
1 Odpoveď
3306 Zobrazenia
Avatar
Tristan Fullmer

I've added a custom selection field in my module and I'd like to show a little icon depending on what is selected. I got all the icons showing up and the selection field working as expected, but the problem comes when I try and show only one icon at a time. Here's the code:

<span>
<
span t-if="record.order_type == 'delivery'" class="fa fa-bus"></span>
<
span t-if="record.order_type == 'store'" class="fa fa-cart-arrow-down"></span>
<
span t-if="record.order_type == 'online'" class="fa fa-laptop"></span>
</
span>
When I added the t-if attributes, nothing showed up. I looked around at other forum posts and at the xml for other kanban views and tried adding ".value" or ".raw_value" after order_type, but that only gave me an error:
Traceback:
TypeError: Cannot read property 'value' of undefined
at Engine.eval (eval at _render (https://tfqoc-lumeprep2-customerflow-2129849.dev.odoo.com/web/content/534-fa1f61a/web.assets_common.js:4426:73), <anonymous>:181:32)
at Engine._render (https://tfqoc-lumeprep2-customerflow-2129849.dev.odoo.com/web/content/534-fa1f61a/web.assets_common.js:4425:296)
at Engine.render (https://tfqoc-lumeprep2-customerflow-2129849.dev.odoo.com/web/content/534-fa1f61a/web.assets_common.js:4425:151)
at Engine._render (https://tfqoc-lumeprep2-customerflow-2129849.dev.odoo.com/web/content/534-fa1f61a/web.assets_common.js:4429:57)
at Engine.render (https://tfqoc-lumeprep2-customerflow-2129849.dev.odoo.com/web/content/534-fa1f61a/web.assets_common.js:4425:151)
at Class._render (https://tfqoc-lumeprep2-customerflow-2129849.dev.odoo.com/web/content/606-2e24acc/web.assets_backend.js:2489:561)
at Class.start (https://tfqoc-lumeprep2-customerflow-2129849.dev.odoo.com/web/content/606-2e24acc/web.assets_backend.js:2481:1273)
at Class.prototype.<computed> [as start] (https://tfqoc-lumeprep2-customerflow-2129849.dev.odoo.com/web/content/534-fa1f61a/web.assets_common.js:4619:488)
at https://tfqoc-lumeprep2-customerflow-2129849.dev.odoo.com/web/content/534-fa1f61a/web.assets_common.js:4950:52
at async Promise.all (index 1)
So it looks like order_type is undefined on the model. However, this is a field that I added, so I know it exists.

I tried adding a t-if on the parent <span> with just "record.order_type" and nothing showed up at all.

So after trying all that, I'm left with one question: How do I access/check field values on my model with t-if?


0
Avatar
Zrušiť
Avatar
Dharmrajsinh Jhala (dja)
Best Answer

You have to add that field in the kanban view, right after you start <kanban> tag.

        

1
Avatar
Zrušiť
Tristan Fullmer
Autor

Yep, that was exactly it! Thanks for the quick response!

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
[14] Cannot able to remove the option from Selection field Solved
selection v14
Avatar
Avatar
Avatar
Avatar
3
aug 24
8669
Make selection invisible when already selected
selection v14
Avatar
Avatar
1
sep 22
2605
Dynamic selection field based on another field (Odoo 14)
fields selection integer v14
Avatar
Avatar
Avatar
2
sep 23
6997
Default property does not apply when overriding selection field.
default field selection v14
Avatar
0
júl 21
94
odoo14 Wizard fiealds become False on button press
wizard fields selection v14
Avatar
Avatar
1
máj 21
3379
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