สอบ ถามครับ ทำเซ็ค if ให้ทำการ checkbox ยังไงครับ สอบถาม Qweb Odoo

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: สอบ ถามครับ ทำเซ็ค if ให้ทำการ checkbox ยังไงครับ สอบถาม Qweb Odoo

Re: สอบ ถามครับ ทำเซ็ค if ให้ทำการ checkbox ยังไงครับ สอบถาม Qweb Odoo

โดย thatsawan » 25/10/2019 3:16 pm

ทำวิธีไหนเเจ้งด้วยค่ะ

Re: สอบ ถามครับ ทำเซ็ค if ให้ทำการ checkbox ยังไงครับ สอบถาม Qweb Odoo

โดย thatsawan » 24/10/2019 3:10 pm

โค้ด: เลือกทั้งหมด

<t t-if="o.quotation" == 1>
                 <input  checked="checked" type="checkbox"/>                      
   </t>

โค้ด: เลือกทั้งหมด

<t t-if="o.quotation" == 0>
                 <input   type="checkbox"/>                      
   </t>
หรือจะใช้ if else

โค้ด: เลือกทั้งหมด

<span class="d-inline-block text-center o_thread_tooltip_snailmail">
            <t t-if="status === 'sent'">
                <i class='fa fa-check o_thread_tooltip_snailmail_icon' title="Sent" role="img" aria-label="Sent"/>
                Sent
            </t>
            <t t-elif="status === 'canceled'">
                <i class='fa fa-trash-o o_thread_tooltip_snailmail_icon' title="Canceled" role="img" aria-label="Canceled"/>
                Canceled
            </t>
            <t t-elif="status === 'pending'">
                <i class='fa fa-clock-o o_thread_tooltip_snailmail_icon' title="Awaiting Dispatch" role="img" aria-label="Awaiting Dispatch"/>
                Awaiting Dispatch
            </t>
            <t t-else="">
                <i class='fa fa-exclamation text-danger o_thread_tooltip_snailmail_icon' title="Error" role="img" aria-label="Error"/>
                Error
            </t>
        </span>

Re: สอบ ถามครับ ทำเซ็ค if ให้ทำการ checkbox ยังไงครับ

โดย mindphp » 24/10/2019 2:55 pm

ลองดูตัวอย่างที่ สองของโพส นี้
https://www.mindphp.com/forums/viewtopic ... 014#p25014

โค้ด: เลือกทั้งหมด

checked="checked"

Re: สอบ ถามครับ ทำเซ็ค if ให้ทำการ checkbox ยังไงครับ

โดย chatee supasand » 24/10/2019 2:49 pm

thatsawan เขียน:เอา code เต็ม
t-field = "o.quotation" ใส่ไปอย่างไง
ต้องการผลอย่างไร
code check box

โค้ด: เลือกทั้งหมด

<td><p><span><input type="checkbox"/>Quotation(RFQ)</span></p></td>
ผลที่ต้องการ คือให้มัน check ตามภาพได้ล่าง
cb.png
cb.png (3.16 KiB) Viewed 1822 times

Re: สอบ ถามครับ ทำเซ็ค if ให้ทำการ checkbox ยังไงครับ

โดย thatsawan » 24/10/2019 2:35 pm

เอา code เต็ม
t-field = "o.quotation" ใส่ไปอย่างไง
ต้องการผลอย่างไร

สอบ ถามครับ ทำเซ็ค if ให้ทำการ checkbox ยังไงครับ สอบถาม Qweb Odoo

โดย chatee supasand » 24/10/2019 2:32 pm

ทำเซ็ค if ให้ทำการ checkbox ยังไงครับ

โค้ด: เลือกทั้งหมด

<p><span><input type="checkbox" />Quotation(RFQ) </span></p>
โดยตอนนี้ผมรับค่ามาจากระบบ มันได้ค่าเป็น True ออกมา

โค้ด: เลือกทั้งหมด

t-field = "o.quotation"
คือผมต้องการ ทำ เช็ค if ให้มันถ้า มีค่า เป็น True ให้ทำการเพิ่ม checked ในเท็ค input เพื่อให้มันติ้กถูก ไม่ทราบว่าต้องเขียน
if ยังไงบ้างครับ

ข้างบน