Skip to Content
Odoo เมนู
  • ลงชื่อเข้าใช้
  • ทดลองใช้ฟรี
  • แอป
    การเงิน
    • ระบบบัญชี
    • ระบบการออกใบแจ้งหนี้
    • ระบบบัญชีรายจ่าย
    • ระบบการจัดการข้อมูลผ่านสเปรดชีต (BI)
    • เอกสาร
    • ระบบลงลายเซ็น
    การขาย
    • ลูกค้าสัมพันธ์
    • การขาย
    • POS ร้านค้า
    • POS ร้านอาหาร
    • ระบบสมัครสมาชิก
    • การเช่า
    การจัดการเว็บไซต์
    • เครื่องมือสร้างเว็บไซต์
    • ระบบการขายออนไลน์
    • บล็อก
    • ฟอรั่ม
    • ไลฟ์แชท
    • ระบบการอบรมออนไลน์
    ซัพพลายเชน
    • คลังสินค้า
    • ระบบการผลิต
    • PLM
    • ระบบการจัดซื้อ
    • การซ่อมบำรุง
    • ระบบจัดการคุณภาพ
    ทรัพยากรบุคคล
    • ข้อมูลพนักงาน
    • ระบบสรรหาบุคลากร
    • ระบบการลา
    • การประเมิน
    • ระบบการแนะนำพนักงาน
    • ระบบจัดการยานพาหนะ
    การตลาด
    • โซเชียลมาร์เก็ตติ้ง
    • การตลาดผ่านอีเมล
    • ระบบการตลาดผ่าน SMS
    • ระบบการจัดงานอีเวนต์
    • การตลาดแบบอัตโนมัติ
    • ระบบแบบสำรวจ
    การบริการ
    • โปรเจกต์
    • ระบบบันทึกเวลา
    • ระบบการจัดการบริการภาคสนาม
    • ระบบดูแลช่วยเหลือ
    • การวางแผน
    • การนัดหมาย
    ประสิทธิผล
    • ระบบแสดงความคิดเห็น
    • ระบบการอนุมัติ
    • ไอโอที
    • VoIP
    • คลังข้อมูล
    • WhatsApp
    แอปพลิเคชันของบุคคลที่สาม Odoo สตูดิโอ แพลตฟอร์มคลาวด์ของ Odoo
  • อุตสาหกรรม
    การค้าปลีก
    • ร้านขายหนังสือ
    • ร้านขายเสื้อผ้า
    • ร้านขายเฟอร์นิเจอร์
    • ร้านขายของชำ
    • ร้านขายฮาร์ดแวร์
    • ร้านขายของเล่น
    Food & Hospitality
    • บาร์และผับ
    • ร้านอาหาร
    • อาหารฟาสต์ฟู้ด
    • Guest House
    • ตัวแทนจำหน่ายเครื่องดื่ม
    • Hotel
    อสังหาริมทรัพย์
    • Real Estate Agency
    • บริษัทสถาปัตยกรรม
    • บริษัทรับเหมา
    • การจัดการอสังหาริมทรัพย์
    • การจัดสวน
    • สมาคมเจ้าของอสังหาริมทรัพย์
    ปรึกษา
    • สำนักงานบัญชี
    • Odoo พาร์ทเนอร์
    • เอเจนซี่การตลาด
    • สำนักงานกฎหมาย
    • บริการสรรหาบุคลากร
    • การตรวจสอบและการรับรอง
    ระบบการผลิต
    • Textile
    • เหล็ก
    • เฟอร์นิเจอร์
    • อาหาร
    • Brewery
    • ของขวัญขององค์กร
    สุขภาพ & ฟิตเนส
    • ชมรมกีฬา
    • ร้านขายแว่นตา
    • ฟิตเนส
    • ผู้ประกอบวิชาชีพด้านสุขภาพ
    • ร้านขายยา
    • ร้านทำผม
    Trades
    • ช่างซ่อม
    • ฮาร์ดแวร์และการสนับสนุนด้านไอที
    • ระบบพลังงานแสงอาทิตย์
    • ช่างทำรองเท้า
    • บริการทำความสะอาด
    • HVAC Services
    อื่น ๆ
    • Nonprofit Organization
    • สำนักงานสิ่งแวดล้อม
    • ร้านเช่าป้ายโฆษณา
    • การถ่ายภาพ
    • ร้านเช่าจักรยาน
    • ตัวแทนจำหน่ายซอฟต์แวร์
    Browse all Industries
  • คอมมูนิตี้
    ศึกษา
    • บทเรียน
    • เอกสารกำกับโปรแกรม
    • การรับรอง
    • การฝึกอบรม
    • บล็อก
    • พอดแคสต์
    เพิ่มศักยภาพให้กับการศึกษา
    • โปรแกรมการศึกษา
    • Scale Up! Business Game
    • เยี่ยมชม Odoo
    รับซอฟต์แวร์
    • ดาวน์โหลด
    • เปรียบเทียบรุ่น
    • เผยแพร่
    ทำงานร่วมกัน
    • Github
    • ฟอรั่ม
    • ระบบการจัดงานอีเวนต์
    • การแปล
    • ร่วมเป็นพาร์ทเนอร์
    • Services for Partners
    • ลงทะเบียนเพื่อสร้างบัญชีบริษัทของคุณ
    รับบริการ
    • ค้นหาพาร์ทเนอร์
    • ค้นหานักบัญชี
    • พบกับที่ปรึกษา
    • บริการติดตั้งระบบเพื่อใช้งาน
    • ข้อมูลอ้างอิงลูกค้า
    • การสนับสนุน
    • อัปเกรด
    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
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
ช่วยเหลือ

Print Button in New Model

ติดตาม

รับการแจ้งเตือนเมื่อมีกิจกรรมในโพสต์นี้

คำถามนี้ถูกตั้งค่าสถานะ
salesfunctionpdf
3 ตอบกลับ
1505 มุมมอง
อวตาร
Óptica Marcopolo

Hola, buenas tardes. Agregué una nueva plantilla a mi módulo de ventas, basada en el diseño del presupuesto, pero orientada a un certificado específico que requiere nuestra empresa. Busco información sobre cómo activar las opciones de impresión o guardar como PDF dentro de esta plantilla. Les agradecería mucho su ayuda.


​

0
อวตาร
ละทิ้ง
อวตาร
Piyush H
คำตอบที่ดีที่สุด

¡Hola! Entiendo que has creado una nueva plantilla de impresión en tu módulo de ventas y quieres habilitar las opciones de impresión y guardar como PDF. Aquí te explico cómo hacerlo:

Pasos para Activar la Impresión y Guardar como PDF

El proceso general implica definir un "report action" en Odoo y asociarlo a tu modelo. Aquí te detallo los pasos:

  1. Crear un Report Action (Acción de Reporte) en XML:
    • Dentro de tu módulo, crea o edita un archivo XML (por ejemplo, views/report_views.xml).
    • Define un ir.actions.report record. Este record le dice a Odoo cómo generar el PDF.
    <odoo>
        <data>
            <report
                id="action_report_mi_certificado"
                model="tu.modelo"  <!-- Reemplaza con el nombre de tu modelo -->
                string="Imprimir Certificado"
                report_type="qweb-pdf"
                name="tu_modulo.reporte_mi_certificado_template"  <!-- Reemplaza con el nombre de tu template -->
                file="tu_modulo.reporte_mi_certificado"  <!-- Reemplaza con el nombre del archivo base -->
                print_report_name="'Certificado - %s' % (object.name)"  <!-- Opcional: Nombre del archivo PDF -->
                binding_model_id="ref('model_tu_modelo')"  <!-- Reemplaza con la referencia al modelo -->
                binding_type="report"
            />
        </data>
    </odoo>
    
    Explicación de los campos:
    • id: Un identificador único para tu report action.
    • model: El nombre del modelo al que pertenece este reporte (ej., sale.order, tu.modelo). Reemplaza tu.modelo con el nombre real de tu modelo.
    • string: El texto que aparecerá en el menú de impresión (ej., "Imprimir Certificado").
    • report_type: qweb-pdf indica que estás usando QWeb para generar el PDF.
    • name: El nombre técnico del reporte. Sigue la convención tu_modulo.nombre_del_template. Reemplaza tu_modulo.reporte_mi_certificado_template con el nombre correcto de tu template QWeb.
    • file: El nombre base del archivo PDF generado. Sigue la convención tu_modulo.nombre_del_archivo. Reemplaza tu_modulo.reporte_mi_certificado con un nombre apropiado.
    • print_report_name: (Opcional) Define el nombre del archivo PDF que se descargará. Puedes usar expresiones Python para hacerlo dinámico (ej., incluir el nombre del cliente). object se refiere al registro actual.
    • binding_model_id: Una referencia al modelo al que se asocia el reporte. Necesitas crear una referencia al modelo en XML.
    • binding_type: report indica que este es un reporte imprimible.
  2. Crear una Referencia al Modelo (si no existe):
    • Si no tienes una referencia a tu modelo en XML, necesitas crearla. Esto se hace en el mismo archivo XML (views/report_views.xml o donde prefieras).
    <record id="model_tu_modelo" model="ir.model">
        <field name="model">tu.modelo</field>  <!-- Reemplaza con el nombre de tu modelo -->
        <field name="name">Tu Modelo</field>  <!-- Reemplaza con un nombre legible para tu modelo -->
    </record>
    
    • Reemplaza tu.modelo con el nombre real de tu modelo.
    • Reemplaza "Tu Modelo" con un nombre descriptivo para tu modelo.
  3. Asegurarte de que tu Template QWeb Existe:
    • Tu template QWeb (el archivo que define el diseño del reporte) debe existir y tener el nombre correcto (el que usaste en el campo name del report action).
    • El template debe estar en un archivo XML (ej., views/report_templates.xml).
    <template id="reporte_mi_certificado_template">
        <t t-call="web.html_container">
            <t t-call="web.external_layout">
                <div class="page">
                    <!-- Aquí va el contenido de tu certificado -->
                    <h1>Certificado</h1>
                    <p>Este es un certificado para: <t t-esc="object.name"/></p>
                </div>
            </t>
        </t>
    </template>
    
    Explicación:
    • id: El identificador único del template. Debe coincidir con el nombre que usaste en el name del report action (ej., tu_modulo.reporte_mi_certificado_template).
    • <t t-call="web.html_container"> y <t t-call="web.external_layout">: Estos templates proporcionan la estructura HTML básica para el reporte (encabezado, pie de página, etc.).
    • <div class="page">: Define una página en el reporte.
    • <t t-esc="object.name"/>: Imprime el valor del campo name del registro actual. object se refiere al registro que estás imprimiendo.
  4. Incluir los Archivos XML en el __manifest__.py:
    • Asegúrate de que los archivos XML que creaste (ej., views/report_views.xml y views/report_templates.xml) estén listados en el data del archivo __manifest__.py de tu módulo.
    {
        'name': 'Mi Módulo de Certificados',
        'version': '1.0',
        'depends': ['sale'],
        'data': [
            'views/report_views.xml',
            'views/report_templates.xml',
        ],
        'installable': True,
        'application': False,
    }
    
  5. Actualizar el Módulo:
    • Después de hacer estos cambios, actualiza tu módulo en Odoo para que los cambios surtan efecto. Ve a la lista de aplicaciones, busca tu módulo y haz clic en "Actualizar".

Cómo Usar la Impresión

Una vez que hayas hecho esto, deberías ver una opción de "Imprimir Certificado" (o el texto que hayas puesto en el campo string del report action) en el menú "Imprimir" (Print) de tu modelo. También deberías poder guardar el reporte como PDF.

Consejos Adicionales

  • Diseño del Reporte: Usa CSS para diseñar tu reporte QWeb. Puedes incluir CSS directamente en el template o enlazar a un archivo CSS externo.
  • Imágenes: Para incluir imágenes en tu reporte, puedes usar la función base64 para codificar la imagen en el XML o usar un enlace a una imagen externa.
  • Depuración: Si tienes problemas, revisa los logs de Odoo para ver si hay errores. También puedes usar el debugger de Python para depurar tu template QWeb.


🚀 Did This Solve Your Problem?

If this answer helped you save time, money, or frustration, consider:

✅ Upvoting (👍) to help others find it faster

✅ Marking as "Best Answer" if it resolved your issue

Your feedback keeps the Odoo community strong! 💪

(Need further customization? Drop a comment—I’m happy to refine the solution!)


0
อวตาร
ละทิ้ง
อวตาร
Óptica Marcopolo
ผู้เขียน คำตอบที่ดีที่สุด

Thank you very much, I will add it

0
อวตาร
ละทิ้ง
อวตาร
Cybrosys Techno Solutions Pvt.Ltd
คำตอบที่ดีที่สุด

Hi, 


To print your custom template, you must create a menu item in Odoo that links to your model and view. This involves defining a menu, an action (typically a window action), and associating that action with a specific model and view.


Menu Action

<record id="action_report_sale_template" model="ir.actions.report">
<field name="name">Sale Report </field>
<field name="model">sale.order</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">module_name.your_template_id</field>
<field name="report_file">module_name.your_template_id</field>
<field name="binding_model_id" ref="sale.model_sale_order"/>
<field name="binding_type">report</field>
</record>

Template


<template id="your_template_id">
<xpath expr="//t[@t-call='web.external_layout']" position="replace">
<t t-call="web.html_container">
#
#
#
#
#
#
</t>
</xpath>
</template>


Hope it helps

0
อวตาร
ละทิ้ง
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!

สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!

ลงชื่อ
Related Posts ตอบกลับ มุมมอง กิจกรรม
adding custom field in quotation/invoice
sales pdf
อวตาร
อวตาร
1
พ.ย. 25
433
Odoo 18 Quotation Builder Header/Footer Print Problem แก้ไขแล้ว
sales pdf
อวตาร
อวตาร
2
ส.ค. 25
4499
Digital products
sales pdf
อวตาร
อวตาร
1
ก.พ. 25
8085
How to hide units of measure in PDF reports?
sales debug pdf
อวตาร
อวตาร
อวตาร
3
ต.ค. 25
626
How to keep footer always at the bottom of the very last page in QWeb PDF report
sales debug pdf
อวตาร
อวตาร
อวตาร
2
ส.ค. 25
1295
คอมมูนิตี้
  • บทเรียน
  • เอกสารกำกับโปรแกรม
  • ฟอรั่ม
โอเพนซอร์ส
  • ดาวน์โหลด
  • Github
  • Runbot
  • การแปล
บริการ
  • โฮสติ้ง odoo.sh เซิร์ฟเวอร์
  • การสนับสนุน
  • อัปเกรด
  • การพัฒนาที่กำหนดเอง
  • การศึกษา
  • ค้นหานักบัญชี
  • ค้นหาพาร์ทเนอร์
  • ร่วมเป็นพาร์ทเนอร์
เกี่ยวกับเรา
  • บริษัทของเรา
  • ทรัพย์สินในรูปของเครื่องหมายการค้า
  • ติดต่อเรา
  • งาน
  • ระบบการจัดงานอีเวนต์
  • พอดแคสต์
  • บล็อก
  • ลูกค้า
  • กฎหมาย • ความเป็นส่วนตัว
  • ความปลอดภัย
الْعَرَبيّة 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

Odoo เป็นชุดแอปธุรกิจแบบเปิดที่ครอบคลุมทุกความต้องการของบริษัทของคุณ อาธิ CRM eCommerce ระบบบัญชี ระบบสินค้าคงคลัง ระบบการขายหน้าร้าน โปรเจกต์ และ อีกมากมาย

ความเหนือกว่าอันเป็นเอกลักษณ์ของ Odoo คือการใช้งานที่ง่ายดายและผสานการทำงานอย่างสมบูรณ์แบบในเวลาเดียวกัน

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