Skip to Content
Menu
This question has been flagged
1 Reply
5515 Views

I have a custom module and created a custom paperformat.


__openerp__.py

{
    'name': " POS Template",
    'author': "Ashiong",
    'version': '1.0',
    'description': """
    - Test
    """,
    'depends': ['stock',
                ],
    'data': [
            'data/report_paperformat.xml',
            'views/delivery_receipt_report.xml',
            'views/picking_report.xml',
    ],
    'auto_install': False,
}

picking_report.xml

        <report             
            id="action_report_delivery_receipt"            
            string="Delivery Receipt (Test POS)"             model="stock.picking"             report_type="qweb-pdf"             name="my_module.test_delivery_receipt"             file="my_module.test_delivery_receipt"         />
        <record id="action_report_test_delivery_receipt" model="ir.actions.report.xml">             <field name="paperformat_id" ref="my_module.test_pos_paperformat"/>         </record>

report_paperformat.xml

    <!-- POS --> 
       <record id="test_pos_paperformat" model="report.paperformat">
        <field name="name">Test Paperformat</field>
        <field name="default" eval="True" />
        <field name="format">custom</field>
        <field name="page_height">150</field>
        <field name="page_width">60</field>
        <field name="orientation">Portrait</field>
        <field name="margin_top">3</field>
        <field name="margin_bottom">3</field>
        <field name="margin_left">3</field>
        <field name="margin_right">3</field>
        <field name="header_line" eval="False" />
        <field name="header_spacing">3</field>
        <field name="dpi">130</field>
       </record>

Once I install my custom module, the system will return an error message:

ParseError: "null value in column "name" violates not-null constraint
DETAIL:  Failing row contains (710, 1, 2017-08-10 10:18:05.557211, null, 1, 2017-08-10 10:18:05.557211, null, ir.actions.report.xml, null, null, t, pdf, null, null, null, null, t, null, f, null, null, null, f, null, 28, 80, null, 1, database, null, null, 1, off, utf_8, f, class Parser(report_sxw.rml_parse):
    def __init__(self, cr, u..., static, f, default, default, null, t, f, null, oo-odt, null).
" while parsing /home/custom_addons/my_module/views/picking_report.xml:13, near
<record id="action_report_pos_delivery_receipt" model="ir.actions.report.xml">
            <field name="paperformat_id" ref="my_module.test_pos_paperformat"/>
        </record>






Avatar
Discard
Best Answer

The bug is here

<record id="action_report_test_delivery_receipt" model="ir.actions.report.xml">
            <field name="paperformat_id" ref="my_module.test_pos_paperformat"/>
        </record>

Because action_report_test_delivery_receipt does not exist in your module. Perhaps you wanna use action_report_delivery_receipt

Avatar
Discard
Author

Hi Sir, I have a follow up question.

I tried to clicked on the button (Delivery Receipt (POS Test) and I encountered this error:

QWebTemplateNotFound: External ID not found in the system: my_module.test_delivery_receipt

Tho I defined the same template in in delivery_receipt_report.xml

<template id="test_delivery_receipt">

<t t-call="report.html_container">

<t t-foreach="docs" t-as="o">

<div class="page" style="font-Size: 9px;">

<div class="row">

<div class="col-xs-12 text-center">

Partner Name:<span t-esc="o.partner_id.name" class="oe_bold"/><br/>

Scheduled Date: <span t-field="o.min_date"/><br/>

Source Document: <span t-field="o.origin"/><br/>

</div>

</div>

</div>

</t>

</t>

</template>

and the template test_delivery_receipt is defined in the module my_module?

curious name for a module :)

Author

Yes, I added the xml (delivery_receipt_report.xml) in the __openerp__.py. I didn't give the exact name of my module, I just put it that way to specify that it is the module name.

Related Posts Replies Views Activity
3
May 24
1863
1
Dec 23
17493
4
Nov 24
5236
2
Aug 24
456
0
May 24
219