Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
5261 Tampilan

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?



Avatar
Buang
Jawaban Terbai

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>
Avatar
Buang
Penulis

is it possible to put that in the home page?

Post Terkait Replies Tampilan Aktivitas
5
Agu 20
7607
2
Jul 18
4161
1
Nov 17
9595
0
Jun 17
2469
6
Des 23
19770