Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
14299 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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>
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 5 23
7759
0
thg 8 20
1889
7
thg 8 19
23938
0
thg 9 18
3961
1
thg 7 17
3775