Skip to Content
Odoo เมนู
  • ลงชื่อเข้าใช้
  • ทดลองใช้ฟรี
  • แอป
    การเงิน
    • ระบบบัญชี
    • ระบบการออกใบแจ้งหนี้
    • ระบบบัญชีรายจ่าย
    • ระบบการจัดการข้อมูลผ่านสเปรดชีต (BI)
    • เอกสาร
    • ระบบลงลายเซ็น
    การขาย
    • ลูกค้าสัมพันธ์
    • การขาย
    • POS ร้านค้า
    • POS ร้านอาหาร
    • ระบบสมัครสมาชิก
    • การเช่า
    การจัดการเว็บไซต์
    • เครื่องมือสร้างเว็บไซต์
    • ระบบการขายออนไลน์
    • บล็อก
    • ฟอรั่ม
    • ไลฟ์แชท
    • ระบบการอบรมออนไลน์
    ซัพพลายเชน
    • คลังสินค้า
    • ระบบการผลิต
    • PLM
    • ระบบการจัดซื้อ
    • การซ่อมบำรุง
    • ระบบจัดการคุณภาพ
    ทรัพยากรบุคคล
    • ข้อมูลพนักงาน
    • ระบบสรรหาบุคลากร
    • ระบบการลา
    • การประเมิน
    • ระบบการแนะนำพนักงาน
    • ระบบจัดการยานพาหนะ
    การตลาด
    • โซเชียลมาร์เก็ตติ้ง
    • การตลาดผ่านอีเมล
    • ระบบการตลาดผ่าน SMS
    • ระบบการจัดงานอีเวนต์
    • การตลาดแบบอัตโนมัติ
    • ระบบแบบสำรวจ
    การบริการ
    • โปรเจกต์
    • ระบบบันทึกเวลา
    • ระบบการจัดการบริการภาคสนาม
    • ระบบดูแลช่วยเหลือ
    • การวางแผน
    • การนัดหมาย
    ประสิทธิผล
    • ระบบแสดงความคิดเห็น
    • ระบบการอนุมัติ
    • ไอโอที
    • VoIP
    • คลังข้อมูล
    • WhatsApp
    แอปพลิเคชันของบุคคลที่สาม Odoo สตูดิโอ แพลตฟอร์มคลาวด์ของ Odoo
  • อุตสาหกรรม
    การค้าปลีก
    • ร้านขายหนังสือ
    • ร้านขายเสื้อผ้า
    • ร้านขายเฟอร์นิเจอร์
    • ร้านขายของชำ
    • ร้านขายฮาร์ดแวร์
    • ร้านขายของเล่น
    Food & Hospitality
    • บาร์และผับ
    • ร้านอาหาร
    • อาหารฟาสต์ฟู้ด
    • Guest House
    • ตัวแทนจำหน่ายเครื่องดื่ม
    • Hotel
    อสังหาริมทรัพย์
    • Real Estate Agency
    • บริษัทสถาปัตยกรรม
    • บริษัทรับเหมา
    • การจัดการอสังหาริมทรัพย์
    • การจัดสวน
    • สมาคมเจ้าของอสังหาริมทรัพย์
    ปรึกษา
    • สำนักงานบัญชี
    • Odoo พาร์ทเนอร์
    • เอเจนซี่การตลาด
    • สำนักงานกฎหมาย
    • บริการสรรหาบุคลากร
    • การตรวจสอบและการรับรอง
    ระบบการผลิต
    • Textile
    • เหล็ก
    • เฟอร์นิเจอร์
    • อาหาร
    • Brewery
    • ของขวัญขององค์กร
    สุขภาพ & ฟิตเนส
    • ชมรมกีฬา
    • ร้านขายแว่นตา
    • ฟิตเนส
    • ผู้ประกอบวิชาชีพด้านสุขภาพ
    • ร้านขายยา
    • ร้านทำผม
    Trades
    • ช่างซ่อม
    • ฮาร์ดแวร์และการสนับสนุนด้านไอที
    • ระบบพลังงานแสงอาทิตย์
    • ช่างทำรองเท้า
    • บริการทำความสะอาด
    • HVAC Services
    อื่น ๆ
    • Nonprofit Organization
    • สำนักงานสิ่งแวดล้อม
    • ร้านเช่าป้ายโฆษณา
    • การถ่ายภาพ
    • ร้านเช่าจักรยาน
    • ตัวแทนจำหน่ายซอฟต์แวร์
    Browse all Industries
  • คอมมูนิตี้
    ศึกษา
    • บทเรียน
    • เอกสารกำกับโปรแกรม
    • การรับรอง
    • การฝึกอบรม
    • บล็อก
    • พอดแคสต์
    เพิ่มศักยภาพให้กับการศึกษา
    • โปรแกรมการศึกษา
    • Scale Up! Business Game
    • เยี่ยมชม Odoo
    รับซอฟต์แวร์
    • ดาวน์โหลด
    • เปรียบเทียบรุ่น
    • เผยแพร่
    ทำงานร่วมกัน
    • Github
    • ฟอรั่ม
    • ระบบการจัดงานอีเวนต์
    • การแปล
    • ร่วมเป็นพาร์ทเนอร์
    • Services for Partners
    • ลงทะเบียนเพื่อสร้างบัญชีบริษัทของคุณ
    รับบริการ
    • ค้นหาพาร์ทเนอร์
    • ค้นหานักบัญชี
    • พบกับที่ปรึกษา
    • บริการติดตั้งระบบเพื่อใช้งาน
    • ข้อมูลอ้างอิงลูกค้า
    • การสนับสนุน
    • อัปเกรด
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    รับการสาธิต
  • ราคา
  • ช่วยเหลือ

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

  • ลูกค้าสัมพันธ์
  • e-Commerce
  • ระบบบัญชี
  • สินค้าคงคลัง
  • PoS
  • โปรเจกต์
  • MRP
All apps
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
ช่วยเหลือ

templating: t-if for string length

ติดตาม

รับการแจ้งเตือนเมื่อมีกิจกรรมในโพสต์นี้

คำถามนี้ถูกตั้งค่าสถานะ
templateskanbant-if
2 ตอบกลับ
11011 มุมมอง
อวตาร
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
อวตาร
ละทิ้ง
อวตาร
Celia
คำตอบที่ดีที่สุด

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
อวตาร
ละทิ้ง
อวตาร
Alexander Soare
ผู้เขียน คำตอบที่ดีที่สุด

@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
อวตาร
ละทิ้ง
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!

สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!

ลงชื่อ
Related Posts ตอบกลับ มุมมอง กิจกรรม
Extending kanban: template t-call not working ? แก้ไขแล้ว
templates kanban t-call V16
อวตาร
1
ส.ค. 24
2227
How to make the order of "default_group_by" in kanban view?
kanban
อวตาร
อวตาร
1
ม.ค. 25
2780
"harmonised" template for various use cases
templates
อวตาร
0
ก.ค. 24
2233
How can i inherit this template? แก้ไขแล้ว
templates
อวตาร
อวตาร
1
ก.ย. 23
2769
How to add search bare in a template that allow to search record in a modele ?
templates
อวตาร
อวตาร
1
มิ.ย. 23
3729
คอมมูนิตี้
  • บทเรียน
  • เอกสารกำกับโปรแกรม
  • ฟอรั่ม
โอเพนซอร์ส
  • ดาวน์โหลด
  • Github
  • Runbot
  • การแปล
บริการ
  • โฮสติ้ง odoo.sh เซิร์ฟเวอร์
  • การสนับสนุน
  • อัปเกรด
  • การพัฒนาที่กำหนดเอง
  • การศึกษา
  • ค้นหานักบัญชี
  • ค้นหาพาร์ทเนอร์
  • ร่วมเป็นพาร์ทเนอร์
เกี่ยวกับเรา
  • บริษัทของเรา
  • ทรัพย์สินในรูปของเครื่องหมายการค้า
  • ติดต่อเรา
  • งาน
  • ระบบการจัดงานอีเวนต์
  • พอดแคสต์
  • บล็อก
  • ลูกค้า
  • กฎหมาย • ความเป็นส่วนตัว
  • ความปลอดภัย
الْعَرَبيّة 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 เป็นชุดแอปธุรกิจแบบเปิดที่ครอบคลุมทุกความต้องการของบริษัทของคุณ อาธิ CRM eCommerce ระบบบัญชี ระบบสินค้าคงคลัง ระบบการขายหน้าร้าน โปรเจกต์ และ อีกมากมาย

ความเหนือกว่าอันเป็นเอกลักษณ์ของ Odoo คือการใช้งานที่ง่ายดายและผสานการทำงานอย่างสมบูรณ์แบบในเวลาเดียวกัน

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