Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Guest House
    • Distributeur de boissons
    • Hotel
    Real Estate
    • Real Estate Agency
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consulting
    • Accounting Firm
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Solar Energy Systems
    • Cordonnier
    • Services de nettoyage
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

Why is the date displayed like this? QWEB

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
dateinheritanceqwebtemplatesodoov11
5 Réponses
6577 Vues
Avatar
Benjamin Cherpas

Hi,


I want to display the activity date deadline but it takes a wrong format. I work on French odoo but the date is displayed in English, with the following format and time set to 00:00:00 but this is a date field not datetime...

Format : Wed Dec 18 2019 00:00:00 GMT+2

This is weird because even in my database, the date is displayed like 18/09/2019, so why is it displayed like that when I call the field in inherited qweb template?


Here is my qweb inheritance: 

<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-extend="mail.KanbanActivityDropdown">
<t t-jquery=".fa-clock-o" t-operation="after">
<t t-if="log.date_deadline > new Date() and log.activity_type_id[1] != 3">
<span><t t-esc="log.date_deadline" /></span>
</t>
</t>
</t>
</templates>


Hope that anyone can help me. Thanks !


UPDATE: 

I already tried t-field, t-options, t-field-options with format or widget: no effect...


Bye.

2
Avatar
Ignorer
faOtools

Try using the widget 'date', e.g.:

<span t-field="log.date_deadline" t-options='{"widget": "date"}'/>
Avatar
faOtools
Meilleure réponse

Okay, it seems that is because of default: date is kept with time zone in the database (not UTC).

I guess the simplest way to replace timezone is to re-calculate date in Python (or alternative apply fields_utils in Javascript). Something like (not tested):

@api.multi
@api.depends("date_deadline")
def _compute_no_tz_date(self):
for record in self:
record.no_tz_date = fields.Date.to_string(record.date_deadline.date())
# perhaps also better to apply time zone transformation
# have a look at the method _compute_state_from_date in the same file
no_tz_date = fields.Date(compute=_compute_no_tz_date)

Then, this no_tz_date should be shown in XML just as a string without time or time zone



1
Avatar
Ignorer
Avatar
Benjamin Cherpas
Auteur Meilleure réponse

It has no effect (see updated answer) I don't understand why...


UPDATE:

date_deadline field in MailActivity object (in mail_activity.py file):

date_deadline = fields.Date('Due Date', index=True, required=True, default=fields.Date.context_today)


Log declaration (I don't know if it is declared in some JS file or not):

<li t-if="!_.isEmpty(records)">
<ul class="nav o_activity_log">
<t t-foreach="_.keys(records)" t-as="key">
<t t-set="logs" t-value="records[key]" />
<li class="o_activity_label">
<strong t-attf-class="o_activity_color_#{key}">
<t t-esc="selection[key]" /> (<t t-esc="logs.length"/>)
</strong>
</li>
<li t-foreach="logs" t-as="log" t-att-data-activity-id="log.id" class="o_schedule_activity">
<div class="o_activity_title pull-left">
<span t-attf-class="fa #{log.icon} fa-fw" />
<strong>
<t t-esc="log.title_action or log.activity_type_id[1]" />
</strong>
<div>
<span class="fa fa-clock-o fa-fw" />
<span t-att-title="log.date_deadline"><t t-esc="log.label_delay" /></span>
<t t-if="log.user_id[0] != uid">
<span class="ml4 fa fa-user" />
<span><t t-esc="log.user_id[1]" /></span>
</t>
</div>
</div>
<div class="pull-right">
<span class="o_mark_as_done o_activity_link o_activity_link_kanban fa fa-check-circle fa-2x mt4" t-att-data-activity-id="log.id" title="Mark as done" />
</div>
</li>
</t>
</ul>
</li>

Thank you for help !

0
Avatar
Ignorer
faOtools

Share then the field date_deadline Python declaration or Javascript code (depending on what is log - Odoo class or Javascript object).

Benjamin Cherpas
Auteur

Done. Thanks !

Benjamin Cherpas
Auteur

Thank you so much it works ! But I used from_string instead of to_string (sorry I can't reply your comment above, just mine). You have been helpful so I'm disappointed to not have enough karma to upvote your answer. Thaaaanks again !!!

faOtools

You are welcome. As for karma: I upvoted your question - the situation is quite interesing. Besides, if you need karma in the Future, you can pass a few learning courses - https://www.odoo.com/slides/all

Benjamin Cherpas
Auteur

Oh nice! I'll think about that! Thanks a lot!

Regards.

Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
Template inheritance not working in Odoo 15
inheritance qweb templates v15
Avatar
Avatar
1
mars 22
7824
How to inherit purchase order body view?
v8 inheritance qweb templates
Avatar
Avatar
2
mars 15
8310
how to change tooltip question mark symbol? Résolu
web inheritance qweb templates frontend
Avatar
1
déc. 23
2390
How to remove template changes made by other addons?
inheritance qweb templates overwriting overriding
Avatar
Avatar
1
sept. 22
6341
Odoo 11: custom report generate empty pdf (html works fine) Résolu
pdf qweb templates v11.0 odoov11
Avatar
Avatar
Avatar
Avatar
Avatar
11
févr. 19
23545
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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