Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
5148 Widoki

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?



Awatar
Odrzuć
Najlepsza odpowiedź

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>
Awatar
Odrzuć
Autor

is it possible to put that in the home page?

Powiązane posty Odpowiedzi Widoki Czynność
5
sie 20
7513
2
lip 18
4084
1
lis 17
9461
0
cze 17
2396
6
gru 23
19649