This question has been flagged

Hello,

I tried to create a custom paper format for my report but it doesn't show any changes.


this is my code in:

purchase_order_templates.xml

		<template id="report_purchaseorder_document_inherit"
inherit_id="purchase.report_purchaseorder_document">
<xpath expr="//div[@class='page']" position="replace">
                                 // code
</xpath>
</template>
                <template id="purchase_order_templates"> <t t-call="report.html_container"> <t t-foreach="docs" t-as="o"> <t t-call="my_module.report_purchaseorder_document_inherit" t-lang="o.partner_id.lang"/>
</t> </t> </template>


purchase_reports.xml

    <report id="custom_report_qweb" string="Custom Report" model="purchase.report" report_type="qweb-pdf"
                    name="my_module.purchase_order_templates"
file="my_module.purchase_order_templates"
paperformat="my_module.paperformat_lowmargin"
/> <record id="paperformat_lowmargin" model="report.paperformat"> <field name="name">Custom PO Paper Format</field> <field name="default" eval="True" /> <field name="format">custom</field> <field name="page_height">140</field> <field name="page_width">216</field> <field name="orientation">Landscape</field> <field name="margin_top">4</field> <field name="margin_bottom">4</field> <field name="margin_left">4</field> <field name="margin_right">4</field> <field name="header_line" eval="False" /> <field name="header_spacing">0</field> <field name="dpi">90</field> </record> <record id="my_module.custom_report_qweb" model="ir.actions.report.xml">
<field name="paperformat_id" ref="my_module.paperformat_lowmargin" /> </record>


purchase_report.py

class PurchaseReport(models.Model):
    _inherit = "purchase.report"

   

__manifest__.py

    'depends': ['purchase'],
    'data': [
        'report/purchase_order_templates.xml',
        'report/purchase_report.xml',
    ],



Any help would be greatly appreciated. Thanks
Avatar
Discard
Author Best Answer

I solved it already. Thanks


            <report 
            id="print_custom_print_layout" 
            string="Purchase Order"
            model="purchase.order" 
            report_type="qweb-pdf"
            name="my_module.purchase_order_templates" 
            file="my_module.purchase_order_templates" 
        />
Avatar
Discard

Hello Kinah,

i tried to do the same thing as you did but i've got this error :

KeyError: 'ir.actions.report.xml'

Have you got an idea to fix this problem ?

Vincent