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

[v8] How to create qweb pdf report correctly using a custom module

اشتراك

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

لقد تم الإبلاغ عن هذا السؤال
qweb-report
2 الردود
11043 أدوات العرض
الصورة الرمزية
bunhin

I have read odoo official documentation on Qweb Report but still not clear enough if i want to add or modify the layout of qweb pdf report by through a custom module, especially which file to place the mentioned code in the documentation, and to which folder i should place the file? I search the web a lot for this but almost all of them just mimic the official doc without adding this lack of information.

to be more tangible i would like to have an example:

said i want to add new sales order pdf report for sales order or quotation, name it  as  "Custom Quotation/Order" this new report :

1.change the layout above the table (positioning)

2.and in below of the table, add "total amount before discount", "total amount of discount" add "amount to text" as well other text div.

I want to do it by creating a custom modul named  "sale_order_custom", so from standard module structure and from learning a sale module structure i create module structure :

addons/sale_custom_report/

|-- __init__.py

|-- __openerp__.py

|-- sale_custom_report_report.xml

|-- models/

| |-- __init__.py

| `-- sale_order_custom.py

|-- report/

| |-- __init__.py

| |-- ??

|-- views/

| |-- report_custom_saleorder.xml

in file    sale_order_custom_report.xml     i put the following code:

    <?xml version="1.0" encoding="utf-8"?>

    <openerp>

         <data>

                <report

                    id="report_custom_sale_order"

                     string="Custom Quotation / Order"

                     model="sale.order"

                     report_type="qweb-pdf"

                     file="sale_order_custom.report_custom_saleorder"

                     name="sale_order_custom.report_custom_saleorder"

                />

            </data>

      </openerp>

in file    report_custom_salorder.xml     i put the following code:

<?xml version="1.0"?>

<openerp>

    <data>

        <template id="report_custom_saleorder">

            <t t-call="report.html_container">

            <t t-foreach="doc_ids" t-as="doc_id">

            <t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'sale.report_custom_saleorder_document')"/>

            </t>

        </t>

</template>

    <template id="sale.report_custom_saleorder_document">

        <t t-call="report.external_layout">

            <div class="page">

                <!--Report Architecture -->

                <div class="row">

                    ......

                    ......

                </div>

         </div>

      </t>

    </template>

   </data>

</openerp>

in  /models/ sale_order_custom.py    i put the following code:

# -*- coding: utf-8 -*-

from openerp import models, fields, api

from openerp.tools import amount_to_text

class sale_order(models.Model):

    _inherit = 'sale.order'

@api.multi

    def amount_to_text(self,amount,currency='Idr'):

    return amount_to_text(amount,currency)

But i am not sure whether it correct to put it under models folder, and what to put in /report/ folder ?

in  __openerp__.py  i put below code:

# -*- coding: utf-8 -*-

{

'name': "custom_sale_order",

'summary': """

Short (1 phrase/line) summary of the module's purpose, used as

subtitle on modules listing or apps.openerp.com""",

'description': """

Long description of module's purpose

""",

'author': "Your Company",

'website': "http://www.yourcompany.com",

'category': 'Uncategorized',

'version': '0.1',

'depends': ['base','sale'],

'data': [

'models/sale_custom_report.py',

'views/report_custom_saleorder.xml',

'report/<?????>',

'sale_order_custom_report.xml',

],

}

Please somebody help to get all file correctly coded,  i believe this will help others people learning to build qweb report from module correctly and respecting odoo module structure.

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

Hi Daniel Rodriguez,

Thank you for your response and guidance and help, it answer about structure, i will try it soon.

There is a function i need to call in the custom_salorder_report (i believe it is not available to call in current existing report of odoo), that is  amount_to_text_en.py function which will display amount total in text. The file is already available in openerp/tools/ folder.

the other, i need to calculate  and display the total amount before discount and total amount of discount if there is discount in order lines ( current standard report display only total of discounted amount before tax, total text, and total amount), i am not sure where to define this function correctly (inheriting sale.order model and add compute fields) or defining a function in report parser.

if i not wrong or misunderstand the documentation, we can use custom report. i quoted the documentation below :

Quote

Custom Reports

The report model has a default get_html function that looks for a model named report.module.report_name. If it exists, it will use it to call the QWeb engine; otherwise a generic function will be used. If you wish to customize your reports by including more things in the template (like records of others models, for example), you can define this model, overwrite the function render_html and pass objects in the docargs dictionary:

from openerp import api, models

class ParticularReport(models.AbstractModel):
    _name = 'report.module.report_name'
    @api.multi
    def render_html(self, data=None):
        report_obj = self.env['report']
        report = report_obj._get_report_from_name('module.report_name')
        docargs = {
            'doc_ids': self._ids,
            'doc_model': report.model,
            'docs': self,
        }
        return report_obj.render('module.report_name', docargs)

Unquote

Please share and help how to do it in each  method? and which method is preferable / better?

 

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

Hi, I think yout structure is not correctly.

The correctly structure must be:

1.__init__.py

1.__openerp__.py

1.reports

2.sale_custom_report_report.xml

With this should be enough.

In __openerp__.py, you can add to data attribute:

'data': [

'reports/sale_custom_report_report.xml',

]

in sale_custom_report_report.xml at the bottom os this file you can add this:

<template id="report_custom_saleorder">

<t t-call="report.html_container">

<t t-foreach="doc_ids" t-as="doc_id">

<t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'sale.report_custom_saleorder_document')"/>

</t>

</t>

</template>

<report

id="report_custom_sale_order"

string="Custom Quotation / Order"

model="sale.order"

report_type="qweb-pdf"

file="sale_order_custom.report_custom_saleorder"

name="sale_order_custom.report_custom_saleorder"

attachment="(object.state in ('open','paid')) and ('Example_report_'+(object.number or '').replace('/','')+'.pdf')"

/>


With this could be enought, but if you have any problem tell me and I try yo help you

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

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

تسجيل
المنشورات ذات الصلة الردود أدوات العرض النشاط
How to create a report with a custom chart and use the chart in the QWEB report?
qweb-report
الصورة الرمزية
0
يناير 24
2256
Curious to know how the same variable show different values under the same loop in Qweb.
qweb-report
الصورة الرمزية
0
يناير 24
1946
Error al imprimir un Qweb (espacio en blanco al principio de la hoja)
qweb-report
الصورة الرمزية
0
فبراير 22
2955
Custom QWEB report in a module
qweb-report
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
2
ديسمبر 15
5813
How to Display Monetary Field in Odoo 15 Qweb Report? تم الحل
qweb-report odoo15CE
الصورة الرمزية
الصورة الرمزية
1
فبراير 25
2612
المجتمع
  • دروس
  • التوثيق
  • المنتدى
مصدر مفتوح
  • تحميل
  • جيت هاب "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