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

I'm trying to create two versions for reports, the view is exactly the same for both versions, but the orientation is different, one report is intended to be printed on A4  Portrait and the other on A4- Lanscape.

The problem is that Odoo always print both reports with the same paper size.

Avatar
Abbandona
Autore

Please anyone body provide me an idea to resolve this case

Risposta migliore

hi everybody,

i'm encountring some issue with odoo 12 community  with paper format declaration: report are well generated and linked to the good paper format (verified on technical settings > reports ) but the output pdf is always A4 format.

it seems like the output is somewhere forced to A4.

if any one could help, it ld be graceful.


thanks in advance

Avatar
Abbandona

hello,

thanks for your hel, it was very helpful.

are you odoo developer ? have you any whatsapp number ?

regards


On 10/11/2020 11:00, Niyas Raphy wrote:
Risposta migliore

Hi,

Please see this method of printing the reports in landscape mode from python code and see whether it helps: How To Print PDF Report In Landscape Mode From Code in Odoo

Sample:

def _print_report(self, data):
data = self.pre_print_report(data)
data['form'].update({'sort_selection': self.sort_selection})
return self.env.ref('account.action_report_journal').with_context(landscape=True).report_action(self, data=data)

Thanks

Avatar
Abbandona
Risposta migliore

Hello Kitty,

You need to define separate paper format for both report and used in paperformat_id of report record

Foe Example :-

Potrait :-
<record id="paper_format_potrait" model="report.paperformat">
    <field name="name">A4 - Potrait</field>
    <field name="format">A4-P</field>
    <field name="orientation">Portrait</field>
    <field name="margin_top">45</field>
    <field name="margin_bottom">25</field>
    <field name="margin_left">7</field>
    <field name="margin_right">7</field>
    <field name="header_spacing">34</field>
    <field name="dpi">90</field>
</record>

<report
    string="report_menu_name"
    id="unique_id_for_report"
    model="model.name"
    report_type="qweb-pdf"
    name="module_name.report_template_id"
    file="module_name.report_template_id"/>

<record id="module_name.report_configuration_id" model="ir.actions.report.xml">
    <field name="paperformat_id" ref="module_name.paper_format_potrait"/>
</record>

Landscape :-
<record id="paper_format_landscape" model="report.paperformat">
    <field name="name">A4 - Landscape</field>
    <field name="format">A4-L</field>
    <field name="orientation">Landscape</field>
    <field name="margin_top">7</field>
    <field name="margin_bottom">7</field>
    <field name="margin_left">7</field>
    <field name="margin_right">7</field>
    <field name="header_spacing">10</field>
    <field name="dpi">90</field>
</record>

<report
    string="report_menu_name"
    id="unique_id_for_report"
    model="model.name"
    report_type="qweb-pdf"
    name="module_name.report_template_id"
    file="module_name.report_template_id"/>

<record id="module_name.report_configuration_id" model="ir.actions.report.xml">
    <field name="paperformat_id" ref="module_name.paper_format_landscape"/>
</record>


Hope it will helps you.
Thanks,

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
3
ago 19
8968
1
gen 24
4879
1
ago 19
14967
0
gen 24
1434