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

templating: t-if for string length

Abonare

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

Această întrebare a fost marcată
templateskanbant-if
2 Răspunsuri
11018 Vizualizări
Imagine profil
Alexander Soare

I want to display an origin ('City A') and destination ('City B') in a kanban template. These are both char fields in my model. I want to bit an arrow '→' between them but only if both are specified. This is a piece of my code:

<span>

<field name="x_quote_pickup_city"/>

<span t-if="x_quote_pickup_city != '' and x_quote_delivery_city != ''"> → </span>

<field name="x_quote_delivery_city"/>

<field name="x_quote_value"/>

</span>

The t-if doesn't seem to be working. This attempt just gives me the '→' even if the chars aren't set.

How would I go about achieving my goal here?

0
Imagine profil
Abandonează
Imagine profil
Celia
Cel mai bun răspuns

Try to do this: 

<field name="x_quote_pickup_city"/> <field name="x_quote_delivery_city"/>     <field name="x_quote_value"/>

<span t-if="x_quote_pickup_city.raw_value and x_quote_delivery_city.raw_value">

    <t t-raw="x_quote_pickup_city.raw_value"/> →

    <t t-raw="x_quote_delivery_city.raw_value"/> </span>

I hope this works

1
Imagine profil
Abandonează
Imagine profil
Alexander Soare
Autor Cel mai bun răspuns

@Celia, I tried and get the following error message upon reloading the page:

Uncaught TypeError: Cannot read property 'raw_value' of undefined

https://erp.ontruck.io/web?debug#view_type=kanban&model=crm.lead&action=146&active_id=3:46

Traceback:

TypeError: Cannot read property 'raw_value' of undefined

at Engine.eval (eval at <anonymous> (https://erp.ontruck.io/web/static/lib/qweb/qweb2.js:402:33), <anonymous>:46:33)

at Engine.QWeb2.Engine.QWeb2.tools.extend._render (https://erp.ontruck.io/web/static/lib/qweb/qweb2.js:391:58)

at Engine.QWeb2.Engine.QWeb2.tools.extend.render (https://erp.ontruck.io/web/static/lib/qweb/qweb2.js:383:26)

at Engine.QWeb2.Engine.QWeb2.tools.extend._render (https://erp.ontruck.io/web/static/lib/qweb/qweb2.js:413:29)

at Engine.QWeb2.Engine.QWeb2.tools.extend.render (https://erp.ontruck.io/web/static/lib/qweb/qweb2.js:383:26)

at OdooClass.Widget.extend.init_content (https://erp.ontruck.io/web_kanban/static/src/js/kanban_record.js:67:34)

at OdooClass.Widget.extend.init (https://erp.ontruck.io/web_kanban/static/src/js/kanban_record.js:42:14)

at OdooClass.prototype.(anonymous function) [as init] (https://erp.ontruck.io/web/static/src/js/framework/class.js:89:38)

at OdooClass.Class (https://erp.ontruck.io/web/static/src/js/framework/class.js:106:33)

at OdooClass.Widget.extend.add_record (https://erp.ontruck.io/web_kanban/static/src/js/kanban_column.js:141:22)

Here is my entire code for your reference: (your solution starting on line 44)

<?xml version="1.0"?>

<xpath expr="//kanban" position="replace">

<kanban default_group_by="stage_id" class="o_kanban_small_column">

<field name="stage_id" options="{&quot;group_by_tooltip&quot;: {&quot;requirements&quot;: &quot;Description&quot;, &quot;legend_priority&quot;: &quot;Use of stars&quot;}}"/>

<field name="color"/>

<field name="priority"/>

<field name="planned_revenue"/>

<field name="user_email"/>

<field name="user_id"/>

<field name="partner_address_email"/>

<field name="message_needaction_counter"/>

<field name="tag_ids"/>

<field name="partner_id"/>

<field name="active"/>

<field name="company_currency"/>

<field name="x_quote_pickup_city"/>

<field name="x_quote_delivery_city"/>

<field name="x_quote_value"/>

<templates>

<field name="date_deadline"/>

<t t-name="kanban-box">

<div t-attf-class="#{kanban_color(record.color.raw_value)} oe_kanban_global_click">

<div class="o_dropdown_kanban dropdown">

<a class="dropdown-toggle btn" data-toggle="dropdown" href="#">

<span class="fa fa-bars fa-lg"/>

</a>

<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">

<t t-if="widget.editable"><li><a type="edit">Edit</a></li></t>

<t t-if="widget.deletable"><li><a type="delete">Delete</a></li></t>

<li t-if="! record.active.value"><a name="action_set_active" type="object">Unarchive</a></li>

<li t-if="record.active.value"><a name="action_set_unactive" type="object">Archive</a></li>

<li><ul class="oe_kanban_colorpicker" data-field="color"/></li>

</ul>

</div>

<div class="oe_kanban_content">

<div>

<field name="tag_ids"/>

</div>

<div>

<strong><field name="name"/></strong>

</div>

<div>

<span t-if="x_quote_pickup_city.raw_value and x_quote_delivery_city.raw_value">

<t t-raw="x_quote_pickup_city.raw_value"/> →

<t t-raw="x_quote_delivery_city.raw_value"/>

</span>

</div>

<div class="text-muted">

<t t-if="record.planned_revenue.raw_value"><field name="planned_revenue" widget="monetary" options="{'currency_field': 'company_currency'}"/></t> <span t-if="record.partner_id.value"> - <t t-esc="record.partner_id.value"/></span>

</div>

<div class="text-muted">

<t t-if="record.date_action.raw_value and record.date_action.raw_value lt (new Date())" t-set="red">oe_kanban_text_red</t>

<span t-attf-class="#{red || ''}">

<field name="date_action"/>

<t t-if="record.date_action.raw_value"> : </t>

<field name="next_activity_id"/>

</span>

</div>

<div class="o_kanban_footer">

<field name="priority" widget="priority" groups="base.group_user"/>

<t t-if="record.message_needaction_counter.raw_value">

<span class="oe_kanban_mail_new" title="Unread Messages"><i class="fa fa-comments"/><t t-raw="record.message_needaction_counter.raw_value"/></span>

</t>

<img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar pull-right"/>

</div>

</div>

<div class="oe_clear"/>

</div>

</t>

</templates>

</kanban>

</xpath>

PS this is for the "CRM - Leads Kanban" view.


0
Imagine profil
Abandonează
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
Extending kanban: template t-call not working ? Rezolvat
templates kanban t-call V16
Imagine profil
1
aug. 24
2236
How to make the order of "default_group_by" in kanban view?
kanban
Imagine profil
Imagine profil
1
ian. 25
2782
"harmonised" template for various use cases
templates
Imagine profil
0
iul. 24
2234
How can i inherit this template? Rezolvat
templates
Imagine profil
Imagine profil
1
sept. 23
2769
How to add search bare in a template that allow to search record in a modele ?
templates
Imagine profil
Imagine profil
1
iun. 23
3729
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