تخطي للذهاب إلى المحتوى
أودو القائمة
  • تسجيل الدخول
  • جرب مجاناً
  • التطبيقات
    المالية
    • المحاسبة
    • فوترة
    • النفقات
    • جدول البيانات (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
حول هذا المنتدى
المساعدة

Qweb - Drop trailing 0's after decimal

اشتراك

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

لقد تم الإبلاغ عن هذا السؤال
qwebreportingreport
8 الردود
23202 أدوات العرض
الصورة الرمزية
Cliff Kujala

How can we format values on Qweb reports to only drop the trailing 0's after the decimal poing in Qweb v8 reports?  Such that 1.0000 would display as 1, 1.5000 would display as 1.5, and 1.5250 would display as 1.525?

Can it be a modification to formatLang(<<your value>>,digits=0)

I want my quantities in Quotes/Sales Orders/Invoice reports to appear like this https://www.purekarting.com/odoo/lightspeedinvoice.pdf instead of how they are currently like this https://www.purekarting.com/odoo/sale.report_saleorder.pdf

0
الصورة الرمزية
إهمال
الصورة الرمزية
Cyrus Waithaka
أفضل إجابة

Qweb allows you to run python expressions using t-esc and t-raw tags. This should therefore work: 

t-esc="int(float(l.quantity))"

I hope this helps.

5
الصورة الرمزية
إهمال
الصورة الرمزية
Stephen Mack
أفضل إجابة

Don't believe there is code to do that.  You will probably need to write some code to handle the special formatting you require.

How about trying this piece of coding based on the text of your question/answer:

<t t-set="mod_qty">
    formatLang(l.product_uom_qty, digit=0)
</t>

<t t-if="mod_qty == l.product_uom_qty">
    <t t-esc="mod_qty" />
</t>

<t t-if="mod_qty != l.product_uom_qty">
    <t t-esc="(l.product_uom_qty * 1)" />
</t>

Or this generic code that will print your list of numbers.

<t t-foreach="[3.000, 3.050, 3.005, 3.0005]" t-as="my_qty">
    <t t-set="mod_qty">
        formatLang(my_qty, digit=0)
    </t>

    <t t-if="mod_qty == my_qty">
        <p><t t-esc="mod_qty"/></p>
    </t>

    <t t-if="mod_qty != my_qty">
        <p><t t-esc="(my_qty * 1)"/></p>
    </t>
</t>

1
الصورة الرمزية
إهمال
الصورة الرمزية
Cliff Kujala
الكاتب أفضل إجابة

I've gotten closer.

https://www.purekarting.com/odoo/sale.report_saleorder_closer.pdf

By using <t t-esc="(l.product_uom_qty * 1)" />, it converts the qty from a string to a number.  Trailing zeros past the first decimal precision are dropped in numbers.

So, seeing as how I have decimal precision set to 3 on product_uom_qty, values will be reported as:

3.000 prints as 3.0
3.050 prints as 3.05
3.005 prints as 3.005
3.0005 is rounded up by Odoo to 3.001, and then prints as 3.001

Close but not perfect.  I'd like to drop that trailing .0 from the whole number quantities still.

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

Why not handle that case in an if statement. Test to see if you have a whole number and then use formatLang to remove the zeros just for whole numbers. Seems you have everything else covered.

Cliff Kujala
الكاتب

Any idea how to check if whole number? IF WHOLE IF NOT THEN THIS FOR w/ Decimals I've also ready through this: https://www.odoo.com/documentation/master/reference/qweb.html There is simply no detailed documentation on writing the conditionals. I also wonder if the decimal trim can't just be done with a t-field-options setting, in the same way we format date fields on reports. However, I can't find the documentation explaining the t-field-options which are available for each specific field. From the Qweb documentation: t-field-options can be used to customize fields, the most common option is widget, other options are field- or widget-dependent.

Stephen Mack

why cant you truncate it to a whole number in formatLang then test it against the original value. If they are equal then it is a whole number and you print the truncated number if not then you print your formatted decimal.

Stephen Mack

I have updated my answer above. Give that a try.

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

what you could  do is :

import openerp.addons.decimal_precision as dp

and also  for example this will allow your field to acces the decimal accuary of account so if you set account to have 8 decimal places your field will have 8 decimal places:

'rent':fields.float('Rent',digits_compute= dp.get_precision('Account')), 

 

 

 

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

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

تسجيل
المنشورات ذات الصلة الردود أدوات العرض النشاط
[SOLVED]Retrieving the product template linked to a variant selected in treeview تم الحل
qweb reporting report
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
3
مارس 18
8773
How to generate custom report with custom data from a wizard? v16 تم الحل
qweb reporting report odoo16features
الصورة الرمزية
الصورة الرمزية
1
مايو 24
4464
How to add the order number in the footer (QWEB)
qweb reporting report odoo10
الصورة الرمزية
0
يوليو 17
4358
odoo 16 report target new page scss
qweb report
الصورة الرمزية
الصورة الرمزية
1
أبريل 25
2170
Missing external identifier on new external layout template تم الحل
qweb report
الصورة الرمزية
الصورة الرمزية
2
مارس 25
2751
المجتمع
  • دروس
  • التوثيق
  • المنتدى
مصدر مفتوح
  • تحميل
  • جيت هاب "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