Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
14512 Vistas

Hello,

i am trying to link a custom paper format to an inherited report via xml code (in Odoo 10 community), but i am getting following error when updating my module mit -u my_module_name when starting the server.

Error:

ParseError: "null value in column "name" violates not-null constraint
DETAIL: Failing row contains (635, 1, null, 1, 2017-04-11 08:06:45.853033, null, 2017-04-11 08:06:45.853033, ir.actions.report.xml, null, null, t, pdf, null, null, null, null, null, t, null, f, null, null, null, f, null, 15, null).
" while parsing /home/odoo/customaddons/my_module/views/paperformat.xml:27, near

<record id="sale.report_saleorder_document" model="ir.actions.report.xml">
    <field name="paperformat_id" ref="my_module.paperformat_sale_order"/>
</record>


and this is the code for my paper format:

<record id="paperformat_sale_order" model="report.paperformat">
            <field name="name">Papier Angebot / Auftragsbestätigung / Rechnung</field>
            <field name="default" eval="True"/>
            <field name="format">custom</field>
            <field name="page_height">297</field>
            <field name="page_width">210</field>
            <field name="orientation">Portrait</field>
            <field name="margin_top">45</field>
            <field name="margin_bottom">25</field>
            <field name="margin_left">20</field>
            <field name="margin_right">20</field>
            <field name="header_line" eval="False"/>
            <field name="header_spacing">30</field>
            <field name="dpi">90</field>
        </record>


and this is how i linked the paperformat to the sale order report:

<record id="sale.report_saleorder_document" model="ir.actions.report.xml">
    <field name="paperformat_id" ref="my_module.paperformat_sale_order"/>
</record>



I just can't see what i did wrong here.


Any help would be greatly appreciated :)

Avatar
Descartar
Mejor respuesta

Hi Korund,

You probably got this figured already, so this post could just be for future reference.

It would seem that Odoo 10 no longer uses the ir.actions.report.xml model to link the paper format to a report.

Instead, in your report record, you could already specify the paper format to use using the paperformat attribute.

e.g.

<report 
string="my report"
id="my_report_id"
model="some.model"
report_type="qweb-pdf"
name="my_module.report_name"
file="my_module.report_file"
paperformat="my_module.paperformat_sale_order"/>


reference: https://www.odoo.com/documentation/10.0/reference/reports.html#paper-format

cheers,

Zhen

Avatar
Descartar
Mejor respuesta

Hi Korund

You could get it fixed like:

<record id="sale.report_sale_order" model="ir.actions.report.xml">
    <field name="paperformat_id" ref="my_module.paperformat_sale_order"/>
</record>
Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
may 23
8048
0
ago 20
2011
7
ago 19
24335
0
sept 18
4122
1
jul 17
3874