تخطي للذهاب إلى المحتوى
أودو القائمة
  • تسجيل الدخول
  • جرب مجاناً
  • التطبيقات
    المالية
    • المحاسبة
    • فوترة
    • النفقات
    • جدول البيانات (BI)
    • المستندات
    • توقيع إلكتروني
    المبيعات
    • إدارة علاقات العملاء
    • المبيعات
    • نقطة البيع للمتاجر
    • نقطة البيع للمطاعم
    • الاشتراكات
    • تأجير
    المواقع الإلكترونية
    • أداة بناء المواقع الإلكترونية
    • متاجر إلكترونية
    • مدونة
    • المنتدى
    • دردشة مباشرة
    • التعليم الإلكتروني
    سلسلة التوريد
    • المستودعات
    • التصنيع
    • إدارة دورة حياة المنتج
    • المشتريات
    • الصيانة
    • الجودة
    الموارد البشرية
    • موظفون
    • التوظيف
    • إجازة عمل
    • التقييمات
    • الإحالات
    • تطبيق الأسطول
    التسويق
    • التسويق الإجتماعي
    • التسويق عبر البريد الإلكتروني
    • التسويق عبر الرسائل النصية
    • فعاليات
    • أتمتة التسويق
    • الاستطلاعات
    الخدمات
    • المشاريع
    • الجداول الزمنية
    • الخدمة الميدانية
    • مكتب المساعدة
    • التخطيط
    • مواعيد
    اﻹنتاجية
    • مناقشة
    • الموافقات
    • إنترنت الأشياء "IoT"
    • بروتوكول ربط المحادثات الصوتية عبر الإنترنت
    • المعرفة
    • WhatsApp
    التطبيقات الخارجية ستوديو أودو منصة أودو السحابية
  • قطاعات الأعمال
    البيع بالتجزئة
    • متجر كتب
    • متجر ملابس
    • متجر أثاث
    • متجر بقالة
    • متجر معدات
    • متجر ألعاب
    الطعام والضيافة
    • بار وحانة
    • المطعم
    • مطعم للوجبات السريعة
    • نزل للضيوف
    • موزّع مشروبات
    • فندق
    العقارات
    • وكالة عقارات
    • شركة هندسة معمارية
    • البناء
    • إدارة العقارات
    • العناية بالحدائق
    • اتحاد مُلاّك العقارات
    استشارة
    • مؤسسة محاسبية
    • شريك أودو
    • وكالة تسويقية
    • منشأة قانونية
    • استقطاب المواهب
    • التدقيق والتوثيق
    التصنيع
    • الأقمشة
    • معدني
    • الأثاث
    • الطعام
    • مصنع خمور
    • هدايا الشركات
    الصحة واللياقة البدنية
    • نادي رياضي
    • متجر نظارات
    • مركز لياقة بدنية
    • الممارسون الصحيون
    • صيدلية
    • صالون تصفيف الشعر
    التجارة
    • عامل صيانة
    • الأجهزة والمعدات التقنية ودعمها
    • أنظمة الطاقة الشمسية
    • صانع أحذية
    • خدمات التنظيف
    • خدمات التكييف (HVAC)
    غير ذلك
    • منظمة غير ربحية
    • وكالة بيئية
    • تأجير لوحات إعلانية
    • تصوير
    • تأجير دراجات
    • بائع وسيط للبرمجيات
    تصفح كافة قطاعات الأعمال
  • مجتمع أودو
    تعلم
    • دروس
    • التوثيق
    • شهادات
    • التدريب
    • مدونة
    • بودكاست
    قم بتعزيز التعليم
    • برنامج تعليم
    • Scale UP! لعبة الأعمال
    • قم بزيارة أودو
    احصل على البرنامج
    • تحميل
    • قارنْ الإصدارات
    • إطلاق
    تعاون
    • جيت هاب "Github"
    • المنتدى
    • فعاليات
    • الترجمات
    • كنْ شريكاً
    • خدمات الشركاء
    • سجل مكتب المحاسبة الخاص بك
    احصل على الخدمات
    • اعثر على شريك
    • اعثر على محاسب
    • قابل أحد مرشدي الأعمال
    • خدمات التنفيذ
    • مراجع العملاء
    • الدعم
    • الترقيات
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    الحصول على عرض توضيحي
  • الأسعار
  • المساعدة

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

  • إدارة علاقات العملاء
  • e-Commerce
  • المحاسبة
  • المخزون
  • PoS
  • المشروع
  • MRP
All apps
يجب أن تكون مسجلاً حتى تتفاعل مع المجتمع.
كافة المنشورات الأفراد الشارات
علامات التصنيف (عرض الكل)
odoo accounting v14 pos v15
حول هذا المنتدى
يجب أن تكون مسجلاً حتى تتفاعل مع المجتمع.
كافة المنشورات الأفراد الشارات
علامات التصنيف (عرض الكل)
odoo accounting v14 pos v15
حول هذا المنتدى
المساعدة

Odoo 11: Wrong values when using widget float_time in qweb report

اشتراك

تسلم الإشعارات عندما يكون هناك نشاط في هذا المنشور

لقد تم الإبلاغ عن هذا السؤال
float_timeWidgetsqweb-reportodoo11community
2 الردود
6282 أدوات العرض
الصورة الرمزية
TK

I am customizing the attendance model and made a wizard that displays a table with an overview of worktime, begin, end and overtime. 

Fields worktime, begin, end and overtime are all fields.Float()

I am using widget='float_time' to display them in the form view of the model. 






I wanted to create a report of that overview that is displayed as qweb-html and can be printed if necessary. 

I created an xml template and used 

It seemed to work because the end field was printed like 18:21.

I compared the form view and the qweb view and discovered that the values are different. 

Some values are just one minute below or above the form view value (ok the rounding seems to work differently) but others are completely nonsense. 

Especially the field overtime differs a lot. 

Form view: -06:40  qweb: -07:19

the correct value that I calculated by hand is -06:40 meaning a float value of -6.66666


Question 1) Where is the calculation difference ? What function is used by the form view and what function is used by the qweb view ?

I only found /web/static/src/js/fields/field_utils.js where there is a formatFloatTime() and a parseFloatTime() function. 


Question 2) Why are the qweb values sometimes completely wrong? 


Yes, I made sure that the field values are completely identical. I even displayed the float values in the qweb report and could validate that they are correct. It is "only" a formatting issue.

0
الصورة الرمزية
إهمال
TK
الكاتب

test

TK
الكاتب

I finally found the answer and if somebody comes across this ...here you are ...

There are indeed two places where conversion is made:

#####################################################

Form view: Javascript method in /web/static/src/js/fields/field_utils.js

#####################################################

function formatFloatTime(value) {

var pattern = '%02d:%02d';

if (value < 0) {

value = Math.abs(value);

pattern = '-' + pattern;

}

var hour = Math.floor(value);

var min = Math.round((value % 1) * 60);

if (min === 60){

min = 0;

hour = hour + 1;

}

return _.str.sprintf(pattern, hour, min);

###########################

QWeb view:

In module base/ir/ir_qweb/fields.py

###########################

class FloatTimeConverter(models.AbstractModel):

""" ``float_time`` converter, to display integral or fractional values as

human-readable time spans (e.g. 1.5 as "01:30").

Can be used on any numerical field.

"""

_name = 'ir.qweb.field.float_time'

_inherit = 'ir.qweb.field'

@api.model

def value_to_html(self, value, options):

hours, minutes = divmod(value * 60, 60)

return '%02d:%02d' % (hours, minutes)

It seems that Math.round and Math.floor behaves differently compared to python divmod function. At least I had huge differences.

الصورة الرمزية
TK
الكاتب أفضل إجابة

Thanks for your answer Karthikeyan if I understand it right, you say there is no difference using the widget in form view and in qweb, but I had different results. There must be a difference. 

Unforunately, I am not used to debugging of javascript otherwise I could follow the code step by step as I do in python code. 


Reply to comment:

If there is a difference while printing in excel where does this come from? Please explain if you know.

0
الصورة الرمزية
إهمال
Begineer

Yeah, the difference will arise only if you print that in excel report

الصورة الرمزية
Begineer
أفضل إجابة

Hi,

    I guess you figured its a formatting issue,

In form view you have used the widget float_time,  to convert the float value into time format (HH:MM)

Same goes while generating a qweb ,  

span t-field="o.your_float_field" t-options= '{"widget": "float_time"}'


I couldn't open and close span tag , make sure you do.

Hope it helps,

Thanks


0
الصورة الرمزية
إهمال
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!

أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!

تسجيل
المنشورات ذات الصلة الردود أدوات العرض النشاط
Print values of field variables declared inside html content Odoo11? تم الحل
html qweb-report odoo11community
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
7
نوفمبر 18
13350
Odoo stays in the loading screen after report is generated
report bug qweb-report odoo11 odoo11community
الصورة الرمزية
الصورة الرمزية
3
يناير 23
7126
Qweb Report : which font display proper output when print PDF in DOT-MATRIX printer ? [ODOO V11 CE]
printer linux_system qweb-report odoo11community dot-matrix
الصورة الرمزية
الصورة الرمزية
1
سبتمبر 20
7057
while print pdf report it takes too much loading time.
loading wkhtmltopdf qweb-report odoo11community printpdf
الصورة الرمزية
الصورة الرمزية
1
ديسمبر 19
6730
Conversion from float_time to float
float_time
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
2
نوفمبر 24
8907
المجتمع
  • دروس
  • التوثيق
  • المنتدى
مصدر مفتوح
  • تحميل
  • جيت هاب "Github"
  • المشغل الآلي رنبوت
  • الترجمات
خدماتنا
  • استضافة أودو إس إتش
  • الدعم
  • الترقية
  • التطويرات المخصصة
  • التعليم
  • اعثر على محاسب
  • اعثر على شريك
  • كنْ شريكاً
معلومات عنا
  • شركتنا
  • أصول العلامة التجارية
  • اتصلْ بنا
  • الوظائف
  • فعاليات
  • بودكاست
  • مدونة
  • عملاء
  • قانوني • الخصوصية
  • الحماية
الْعَرَبيّة 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

أودو هو عبارة عن مجموعة من تطبيقات الأعمال مفتوحة المصدر التي تغطي جميع احتياجات شركتك، مثل: إدارة علاقات العملاء والتجارة الإلكترونية والمحاسبة والمخزون ونقاط البيع وإدارة المشاريع وما إلى ذلك.

ما يجعل من أودو مميزاً هو هدفه بأن يكون سهل الاستخدام للغاية ومتكاملاً تمامًا في الوقت ذاته.

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