Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

Why is the date displayed like this? QWEB

Naroči se

Get notified when there's activity on this post

This question has been flagged
dateinheritanceqwebtemplatesodoov11
5 Odgovori
6586 Prikazi
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
Opusti
faOtools

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

<span t-field="log.date_deadline" t-options='{"widget": "date"}'/>
Avatar
faOtools
Best Answer

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
Opusti
Avatar
Benjamin Cherpas
Avtor Best Answer

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
Opusti
faOtools

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

Benjamin Cherpas
Avtor

Done. Thanks !

Benjamin Cherpas
Avtor

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
Avtor

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

Regards.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Template inheritance not working in Odoo 15
inheritance qweb templates v15
Avatar
Avatar
1
mar. 22
7833
How to inherit purchase order body view?
v8 inheritance qweb templates
Avatar
Avatar
2
mar. 15
8316
how to change tooltip question mark symbol? Solved
web inheritance qweb templates frontend
Avatar
1
dec. 23
2391
How to remove template changes made by other addons?
inheritance qweb templates overwriting overriding
Avatar
Avatar
1
sep. 22
6344
Odoo 11: custom report generate empty pdf (html works fine) Solved
pdf qweb templates v11.0 odoov11
Avatar
Avatar
Avatar
Avatar
Avatar
11
feb. 19
23549
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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