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

change printed file name in webkit report in odoo?

اشتراك

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

لقد تم الإبلاغ عن هذا السؤال
qwebreportwebkit_report
11 الردود
19528 أدوات العرض
الصورة الرمزية
Nikunj Nakum

How to change name of resultant file name in odoo webkit report?

 

for example : now is printing --> sale.report_saleorder.pdf 

but i want in this way --> Sale Order.pdf

Thank In advance

 

 

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

This is a complete code that change behaviour to force your own file name without breaking compatibility with other reports and without changing Odoo core. Check you edit value for 'nameofreporttochange' with name of report (you will find it into console because it is output into log).

Just put this into a file   myfile.py and declare this file into manifest of your module.

from openerp.addons.web.http import Controller, route, request
from openerp.addons.web.controllers.main import _serialize_exception
from openerp.osv import osv
from openerp.addons.report.controllers.main import ReportController
from openerp import http
import simplejson
import logging


# Surcharge la fonction report_download afin de pouvoir modifier le
# content assist pour forcer la valeur du 'Content-Disposition' et forcer le nom du fichier telecharge.
class SponsorReportController(ReportController):

    @route(['/report/download'], type='http', auth="user")
    def report_download(self, data, token):
        logging.info("report_download")
        requestcontent = simplejson.loads(data)
        url, type = requestcontent[0], requestcontent[1]
        
        logging.info(url)
        logging.info(type)

        response = ReportController().report_download(data, token)

        if len(url.split('/report/pdf/')) > 1 and type == 'qweb-pdf':
            reportname = url.split('/report/pdf/')[1].split('?')[0]
            reportname, docids = reportname.split('/')
            logging.info(reportname)
            assert docids
            logging.info(docids)
        
            if reportname == 'nameofreporttochange':
                filename = 'My new filename'
                if docids.isnumeric():
                    partner_obj = http.request.env['res.partner']
                    object = partner_obj.browse(int(docids))
                    filename = filename + " - " + object.name
            
            response.headers.set('Content-Disposition', 'attachment; filename=%s.pdf;' % filename)
            
        return response

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

Here is our solution to include the sale order name (SO000012, SO000013, etc.) in the file name of the sale orders reports pdf via « Print » buttons.

Content of control_pt.py :

import pdb
from openerp.addons.web.http import Controller, route, request
from openerp.addons.report.controllers.main import ReportController
from openerp.osv import osv
from openerp import http
import simplejson

class PTReportController(ReportController):
    @route(['/report/download'], type='http', auth="user")
    def report_download(self, data, token):
        order_obj = http.request.env['sale.order']
        requestcontent = simplejson.loads(data)
        url, type = requestcontent[0], requestcontent[1]
# url = u'/report/pdf/sale.report_saleorder/37'
# type = u'qweb-pdf'
        assert type == 'qweb-pdf'
        reportname = url.split('/report/pdf/')[1].split('?')[0]
# reportname = u'sale.report_saleorder/37'
        reportname, docids = reportname.split('/')
# reportname = u'sale.report_saleorder'
# docids = 37
        assert docids
        object = order_obj.browse(int(docids))

        name = object.name
# name = 2014-DE000020
        filename = 'PT_' + object.name
# filename = PT_2014-DE000020

        response = ReportController().report_download(data, token)
        response.headers.set('Content-Disposition', 'attachment; filename=%s.pdf;' % filename)
        return response

0
الصورة الرمزية
إهمال
الصورة الرمزية
Jainesh Shah(Aktiv Software)
أفضل إجابة

Hi Nikunj,

This code prints the report with the dynamic pdf names without affecting other reports of the same module or base :

from odoo.addons.report.controllers.main import ReportController 
from odoo import http import simplejson import logging class PrintReport(ReportController):     @http.route(['/report/download'], type='http', auth="user")     def report_download(self, data, token):         logging.info("report_download")         requestcontent = simplejson.loads(data)         url, type = requestcontent[0], requestcontent[1]         logging.info(url)         logging.info(type)         response = super(PrintReport,self).report_download(data,token)         if len(url.split('/report/pdf/')) > 1 and type == 'qweb-pdf':             reportname = url.split('/report/pdf/')[1].split('?')[0]             reportname, docids = reportname.split('/')             logging.info(reportname)             assert docids             logging.info(docids)             if reportname == 'module_name.report_template_name':                 filename = 'module_template.report_template_name'                 if docids.isdigit():                     obj = http.request.env['model.name']                     object = obj.browse(int(docids))                     filename = object.field_name + " " + object.field_name                 else:                     filename = 'File_name'        ### will print multiple reports with the respective name given                 response.headers.set('Content-Disposition', 'attachment; filename=%s.pdf;' % filename)         return response

Hope this will help you.

Thanks.

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


you just have to overwrite controller method. report_download()

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

You can check out my solution at stackoverflow http://stackoverflow.com/questions/30485464/how-to-set-pdf-name-in-qweb-report-odoo/32152798#32152798

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

wrong link?

Jeroen Vet

Yes, sorry, fixed the link.

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

Yes... but it is sometype of hacking.... why odoo not give that because... in python if we take unicodecharacter in file name it gives parsing error...  if you want to try that fix name like "čćžšđ" and it give error... and odoo is support multi language... this is crotian character... if some one put this type of name it become problem.. so odoo not give that..

0
الصورة الرمزية
إهمال
الصورة الرمزية
Serpent Consulting Services Pvt. Ltd.
أفضل إجابة

Nikunj,

The tecnical workaround is big and needs customization.

For quicker solution, go to odoo/addons/report/controllers/main.py line 123, change reortname!

Thanks.

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

It is how i'm trying to do now. But how to get the report_filename there?

الصورة الرمزية
Torvald Baade Bringsvor
أفضل إجابة

An inbetween solution can be to override the ReportController for the /report/download URL.

This is what I did:

from openerp.addons.web.http import Controller, route, request
from openerp.addons.web.controllers.main import _serialize_exception
from openerp.osv import osv
from openerp.addons.report.controllers.main import ReportController
from openerp import http
import simplejson


class SponsorReportController(ReportController):

    @route(['/report/download'], type='http', auth="user")
    def report_download(self, data, token):
        partner_obj = http.request.env['res.partner']
        requestcontent = simplejson.loads(data)
        url, type = requestcontent[0], requestcontent[1]
        assert type == 'qweb-pdf'
        reportname = url.split('/report/pdf/')[1].split('?')[0]

        reportname, docids = reportname.split('/')
        assert docids
        object = partner_obj.browse(int(docids))
        response = ReportController().report_download(data, token)
        filename = object.report_filename

        response.headers.set('Content-Disposition', 'attachment; filename=%s.pdf;' % filename)
        return response

As you can see I have copied some of the code from odoo/addons/report/controllers/main.py to get the ID of the document, then I invoke the report_filename on the object and overwrite the Content-Disposition header in the response. This is a little cleaner than messing with the core code. Hope this helps you.

 

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

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

تسجيل
المنشورات ذات الصلة الردود أدوات العرض النشاط
odoo 16 report target new page scss
qweb report
الصورة الرمزية
الصورة الرمزية
1
أبريل 25
2317
Missing external identifier on new external layout template تم الحل
qweb report
الصورة الرمزية
الصورة الرمزية
2
مارس 25
3026
Translate month name in t-esc Qweb report تم الحل
qweb report
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
4
نوفمبر 24
8358
QWeb Report Shows Different When Edit And Print Review تم الحل
qweb report
الصورة الرمزية
الصورة الرمزية
1
مارس 24
3086
How display the currency symbol before the subtotal value on Quotation report? تم الحل
qweb report
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
3
سبتمبر 23
26259
المجتمع
  • دروس
  • التوثيق
  • المنتدى
مصدر مفتوح
  • تحميل
  • جيت هاب "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