Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5328 Lượt xem

I have installed a new app my odoo 10 installation on my local server.

The readme file of the module is the follow:

 Countdown Widget================
This module add functionality to add widget directly to datetime field on website template.
Example:
++++++++++
Add   t-field="obj.datetime_field" 
t-field-options='{"widget": "countdown"}'

Any idea what are the step to enable that widget? Where I should add that code?



Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

You are talking about following addon right?:

https://www.odoo.com/apps/modules/10.0/website_countdown/

But I found a small bug on that, when you try to use that widget, will get internal server error telling that template not found.

To fix it, goto website_countdown >> views >> countdown.xml

Then change <template id="front_countdown"> to <template id="countdown">

May be the authors gona update that, since I posted the bug on app page. So please check the above thing before installing.


After fixing that, you can use that widget in the templates used for building pages in website modules. For eg: website_sale, website_event etc

It can be used on datetime fields in the object. Then it displays a countdown till that date. For example, on website_event module, in the template used for event details, I can add this widget on the event start date, then it shows count down till that date which event begins, like this:


To get like above, am using the widget on event_details template which you can find in website_event >>views>>website_event_templates.xml. For eg: 

<template id="event_details">        
    <t t-call="website_event.layout">
        <div itemscope="itemscope" itemtype="http://schema.org/Event" class="container">
            <h1 itemprop="name" class="text-center" t-field="event.name"></h1>     
            <div class="text-center">
                <small t-if="event.is_participating" class="label label-info">Participating</small>
            </div>
            <div class="text-center">
                <span t-field="event.with_context(tz=event.date_tz).date_begin" t-options='{"widget": "countdown"}'/>
            </div>
            <h4 class="text-center text-muted">
                <i class="fa fa-clock-o"></i>
                    <span itemprop="startDate" t-field="event.with_context(tz=event.date_tz).date_begin" t-options='{"hide_seconds":"True"}'/> to
                    <span itemprop="endDate" t-field="event.with_context(tz=event.date_tz).date_end" t-options='{"hide_seconds":"True"}'/>
                    <t t-if="event.date_tz">(<span t-field="event.date_tz"/>)</t>
            </h4>
            <h4 class="text-center text-muted"
                 t-field="event.address_id"
                 t-options='{
                 "widget": "contact",
                 "fields": ["city"]
                }'/>
            <div class="row mt32 mb32">
                <t t-raw="0"/>
            </div>
        </div>
    </t>
</template>
Ảnh đại diện
Huỷ bỏ
Tác giả

is it possible to put that in the home page?

Bài viết liên quan Trả lời Lượt xem Hoạt động
5
thg 8 20
7650
2
thg 7 18
4198
1
thg 11 17
9664
0
thg 6 17
2509
6
thg 12 23
19835