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 can I override the print action

By
klacus
on 4/25/13, 8:06 AM 1,097 views

Hi. My problem is the following.

I want to put the printing info's into account.invoice table. When I click the Print invoice the follow code is running, sure :-)

import time
from report import report_sxw

class account_invoice(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(account_invoice, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
        })
report_sxw.report_sxw(
    'report.account.invoice',
    'account.invoice',
    'addons/account/report/account_print_invoice.rml',
    parser=account_invoice
)

I can catch it. But how can I override this function. I want to put some new element to store the printing status, new for the printing point of view, or already printed and this is just a copy... This is necessary according some stupid government invoicing rule. This is a /addons/account/report/account_print_invoice.py

I read somewhere, the report override is not supported, but in this case how can I catch the printing...?

other way to change the print button for a new one. In this case I need to change the action. I checked this button has an dynamic action / id name.

in account_invoice_view.xml I found this:

<button name="%(account_invoices)d" string="Print Invoice" type="action" icon="gtk-print" states="open,paid,proforma,sale,proforma2"/>

How openerp know what should be do? I don't understand what is the background... I see this button is joining to ir.action table the data is this:

"326";"Invoices";"ir.actions.report.xml";"default";1;"2013-01-01 15:26:50.942508";"2013-04-24 04:23:03.254566";1

And this ir.action is joining to ir_act_report_xml table where the name is same...

538;"Invoices";"ir.actions.report.xml";"";1;"2013-01-05 04:53:59.597897";"2013-04-25 05:34:03.233866";1;"account.invoice";"account.invoice.layout";"";"";FALSE;"<binary data>";TRUE;"pdf";"csysc_nhm_reports/account_print_nhm_invoice.rml";FALSE;"csysc_nhm_reports/account_print_nhm_invoice.rml";"";"<binary data>";FALSE

But where is the code what is call the /addons/account/report/account_print_invoice.py?

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

0 follower(s)

Stats

Asked: 4/25/13, 8:06 AM
Seen: 1097 times
Last updated: 3/16/15, 8:10 AM