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

Put the name of a select field in a qweb report

اشتراك

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

لقد تم الإبلاغ عن هذا السؤال
qwebreportodoo
3 الردود
6341 أدوات العرض
الصورة الرمزية
Learning_Odoo
judgements = fields.Selection(
[
('family_lawsuits', 'Juicios Familiares')])

I have this selector that is stored inside a one2many, when I command to call the field in the qweb and print it, I want it to print the option that says "Family Lawsuits", but it prints the first option that is "family_lawsuits", how can I do to print the second option?
I already tried putting a .name at the end of the field, but it gives me the following error: AttributeError: 'str' object has no attribute 'name'


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

Hi,

Try,

<t t-esc="dict(object.fields_get(allfields=['your_selection_field'])['your_selection_field']['selection'])[object.your_selection_field]"/>


1
الصورة الرمزية
إهمال
الصورة الرمزية
Gracious Joseph
أفضل إجابة

In Odoo QWeb reports, when working with Selection fields, the value stored in the database (e.g., family_lawsuits) is returned by default. If you want to display the human-readable label (e.g., Juicios Familiares), you need to use the dict() function to map the selection field value to its label.

Here’s how you can print the label of a selection field in a QWeb report:

1. Add a Helper Method in the Model

To make the selection field's label accessible in your QWeb report, add a helper method in your model.

Example:

class YourModel(models.Model):
    _name = 'your.model'

    judgements = fields.Selection(
        [('family_lawsuits', 'Juicios Familiares')],
        string="Judgements"
    )

    def get_judgement_label(self, value):
        """
        Returns the human-readable label for the judgements selection field.
        """
        selection_dict = dict(self.fields_get()['judgements']['selection'])
        return selection_dict.get(value, '')

2. Use the Helper Method in QWeb

In your QWeb template, you can now call this helper method to fetch and display the human-readable label.

Example QWeb Template:

<t t-foreach="doc.one2many_field_ids" t-as="line">
    <tr>
        <td>
            <!-- Call the helper method to get the label -->
            <t t-esc="line.get_judgement_label(line.judgements)"/>
        </td>
    </tr>
</t>

3. Directly Map Selection Field in QWeb (Without a Helper)

If you don’t want to define a helper method, you can directly use the dict() function in your QWeb report. However, this approach is less reusable.

Example:

<t t-foreach="doc.one2many_field_ids" t-as="line">
    <tr>
        <td>
            <!-- Map the selection value to its label -->
            <t t-esc="dict(line.fields_get()['judgements']['selection'])[line.judgements]"/>
        </td>
    </tr>
</t>

Note: This direct method works, but if you have many fields to convert or if you need to reuse the logic elsewhere, the helper method is better.

4. If the Selection Field Is in a Related Model

If the judgements field is in a related model (e.g., a one2many), you must use the dict() function or helper method on the related record.

Example for Related Models:

<t t-foreach="doc.one2many_field_ids" t-as="line">
    <tr>
        <td>
            <t t-esc="dict(line.fields_get()['judgements']['selection'])[line.judgements]"/>
        </td>
    </tr>
</t>

5. Final Debugging Tips

  • Ensure the selection field is accessible in the record you are iterating over.
  • Use t-esc to evaluate Python expressions in QWeb safely.
  • Use t-debug to inspect values in the report during development.
<t t-debug="line.judgements"/>

By following this approach, you’ll be able to display the human-readable label (Juicios Familiares) of the selection field in your QWeb report. Let me know if you need further assistance!

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

You can user the following: 

map_report_type = dict(self._fields["report_type"].selection)


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

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

تسجيل
المنشورات ذات الصلة الردود أدوات العرض النشاط
Expect singleton: res.currency[SOLVED] تم الحل
qweb report odoo
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
2
يونيو 23
5705
Pass result from SQL Query to Qweb Report
qweb report odoo
الصورة الرمزية
0
مارس 22
3128
How to groups the same value name on QWEB Report Odoo ??
qweb report odoo
الصورة الرمزية
0
أغسطس 21
5914
How To pass data to report action ?
qweb report odoo
الصورة الرمزية
0
أبريل 18
9502
How to customize qweb report ? تم الحل
qweb report odoo
الصورة الرمزية
1
ديسمبر 17
8817
المجتمع
  • دروس
  • التوثيق
  • المنتدى
مصدر مفتوح
  • تحميل
  • جيت هاب "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