Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
698 Visualizzazioni

I want to do this activity, before doing that i need background analysis, because  I am a beginner, This is the activity,

Qweb Report

  1. Inherit Pro-forma invoice Report.
  2. Use a custom paper format: A4 size, landscape orientation, with 20mm margins.
  3. Use a shared/common layout template that includes:
  • Company logo at the top center.
  • Report title in bold.
  • Footer with the page number and printed date.

Customize report

    • Should apply created custom layout(point 3)
    • Show product image in order lines
    • Show discount in order lines
    • Add table border

My questions are?
1)What are the required files to complete this activity?

2)If Python files are not required , why? How can i find this related python file in  core?

3)How these required files connect to each files? 

4)Background of this question (purpose) can someone help me? I want to simple answers to these questions

Avatar
Abbandona
Risposta migliore

Hi,

You can create a custom paper format through the UI or by using code. The page number is already shown in the report by default. To display the printed date, you need to create a custom layout. A Python file is not required, as the report is connected to the model through the report action using the binding ID, which allows you to access all data from that model.


1. Custom Paper Format

Settings-> Technical-> reporting-> Paper Formats.


- Landscape orientation can be set using the Orientation field

- Choose Pro-forma Invoice in the Associated Reports field.

- You can set the top, bottom, left, and right margins as needed.


2. Custom Layout 

Sample custom layout

<template id="report_custom_external_layout">
<!-- Multicompany -->
<t t-if="not o and doc">
<t t-set="o" t-value="doc"/>
</t>
<t t-if="o and 'company_id' in o">
<t t-set="company" t-value="o.company_id"></t>
</t>
<t t-if="not o or not 'company_id' in o">
<t t-set="company" t-value="res_company"></t>
</t>
<div class="header">
<div class="row">
<img t-if="company.custom_report_header"
t-att-src="image_data_uri(company.custom_report_header)"
alt="Logo" width="100%"/>
</div>
</div>
<div class="footer o_standard_footer" style="position: relative;">
<div style="width: 100%;">
<div class="row"
style="display: -webkit-box; display: flex; -webkit-justify-content: space-between; justify-content: space-between; width: 100%;">
<div class="col-4 text-center" style="font-size: 10px;">
<span t-esc="time.strftime('%Y-%m-%d')"/>-
<span t-esc="time.strftime('%H:%M')"/>
</div>
<div class="col-4 text-center" style="font-size: 10px;">
<span>Page</span>
<span class="page"/>/
<span class="topage"/>
</div>
</div>
</div>
<div style="width: 100%;">
<img t-if="company.custom_report_footer"
t-att-src="image_data_uri(company.custom_report_footer)"
alt="Logo" width="100%"/>
</div>
</div>
<div class="article o_report_layout_standard"
t-att-data-oe-model="o and o._name"
t-att-data-oe-id="o and o.id"
t-att-data-oe-lang="o and o.env.context.get('lang')">
<t t-raw="0"/>
</div>
</template>


<div class="col-4 text-center" style="font-size: 10px;">

                    <span t-esc="time.strftime('%Y-%m-%d')"/>-

                    <span t-esc="time.strftime('%H:%M')"/>

                </div>

This code indicates - printed date and time


3. Inherit Pro-Forma Invoice 


    <template id="sale_order_report_saleorder_document"
inherit_id="sale.report_saleorder_document">
<xpath expr="//t[@t-call='web.external_layout']" position="replace">
<t t-call="module_name.report_custom_external_layout">
<!-- Details-->
</t>
</xpath>
</template>


Hope it helps.

Avatar
Abbandona
Risposta migliore

Hello Kalana Piyumantha,

 

Please refer to the following documentation and YouTube playlist to understand how to work with PDF reports in Odoo:

 https://www.odoo.com/documentation/18.0/developer/tutorials/pdf_reports.html

 https://www.youtube.com/playlist?list=PLqRRLx0cl0hqclwqsT4cm8vkIU4NAj3uA

If you have any questions, please feel free to reach out to me. I'm happy to help!

 

Thanks & Regards,

Email:  odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari 

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
gen 24
1599
1
apr 23
3004
4
apr 24
20405
2
giu 20
5638
3
nov 15
5400