Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
40435 มุมมอง

i have been customized an odoo report to print employee attendances,
the time of check in and out is correct in UI , but when i print the report it increase 2 hours for every record

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi Mohamed:

Odoo  displays the timezone information based on a user's preferences. However, if all your users are located in the same timezone you can try this:

  • Activate developer mode

  • Go to Settings > Users & Companies

  • Set the filter to "Inactive Users"

  • One of the inactive users will be something called "odoobot". Update the "Timezone" in the "Preferences" tab of this user to your local timezone.

Hope this helps.

อวตาร
ละทิ้ง
ผู้เขียน

it's not working for me

Try adding the following to your field in your customized report.

t-options="{'widget': 'datetime'}"

For example, <span t-field="o.date_invoice" t-options="{'widget': 'datetime'}"/>

ผู้เขียน

thank you very much , it work well now after adding widgets

thank you very much it work well

คำตอบที่ดีที่สุด


Hi,
   Just try this
from datetime import datetime

import pytz

user_tz = self.env.user.tz or pytz.utc

local = pytz.timezone(user_tz)

display_date_result = datetime.strftime(pytz.utc.localize(datetime.strptime(your_date_or_datetime_info, DEFAULT_SERVER_DATETIME_FORMAT)).astimezone(local),"%d/%m/%Y %H:%M%S")


อวตาร
ละทิ้ง