Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to automatically assign a special page format to the invoices from my module ?

By
Theudric Enicar
on 6/5/15, 3:26 PM 409 views

I can do it manually:

Settings / Technical / Reports / Paper Format / MySpecialFormat => Associated reports = Invoices

But from my module, what is the code ?


Solved below. Can be closed !

Sorry, I have few virtual karma


1
Buddhima
On 6/16/15, 1:38 AM

You can create a custom paperformat like this in your report.xml


<record id="my_custom_format" model="report.paperformat">

     <field name="name">Item Label</field>

     <field name="default" eval="True"/>

     <field name="format">custom</field>

     <field name="page_height">90</field>

     <field name="page_width">254</field>

     <field name="orientation">Portrait</field>

     <field name="margin_top">0</field>

     <field name="margin_bottom">0</field>

     <field name="margin_left">0</field>

     <field name="margin_right">0</field>

     <field name="header_line" eval="False"/>

     <field name="header_spacing">0</field>

    <field name="dpi">80</field>

</record>


then link it with your report

<record id="id_of_your_report" model="ir.actions.report.xml">

      <field name="paperformat_id" ref="YourModule.my_custom_format" />

</record>

0
Theudric Enicar
On 6/7/15, 1:34 PM

Thanks zbik for your reply but sorry, I don't get it

Here is my xml paper format content:

<report
     id="MyModule_paper_report"
     string="MyModule"
     model="MyModule.paper_report"
     report_type="qweb-pdf"
    name="MyModule.paper_report"
    file="MyModule.paper_report"
/>

I tried to do it in the xml instead the code (your links) but without success neither. In fact I don't know what to replace in your code example.

By setting string="Invoices" (as above in xml) is doesn't work
When I check In Settings/Technical/Reports/Paper Format/ MyModule => Displays "Invoices" but not working when I print one invoice


Thanks to all.
What I was looking for was : <record id="account.account_invoices"
Done in xml (instead python code) because much simpler.

=> When I check In Settings/Technical/Reports/Paper Format/ MyModule => Displays "Invoices" and works when I print one invoice.
May be I was not clear enough in the description. Sorry for that.

Link to documentation: https://www.odoo.com/documentation/8.0/reference/reports.html#reference-reports-paper-formats

zbik
on 6/8/15, 2:46 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 6/5/15, 3:26 PM
Seen: 409 times
Last updated: 6/18/15, 3:09 AM