Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
14302 มุมมอง

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 :)

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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>
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
พ.ค. 23
7768
0
ส.ค. 20
1890
7
ส.ค. 19
23941
0
ก.ย. 18
3962
1
ก.ค. 17
3777