Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
4 Ответы
6554 Представления

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.

Аватар
Отменить
Автор

Please anyone body provide me an idea to resolve this case

Лучший ответ

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

Аватар
Отменить

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:
Лучший ответ

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

Аватар
Отменить
Лучший ответ

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,

Аватар
Отменить
Related Posts Ответы Просмотры Активность
3
авг. 19
9075
1
янв. 24
4982
1
авг. 19
15090
0
янв. 24
1524