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

Modify / override button action in header of form ?

By
Benoit COVILLE
on 12/6/13, 7:26 AM 3,931 views

Hi,

It's a bit confusing for me : I would like to modify / override a button displayed in the header of a form to match the action of the button to one of mine defined in Configuration -> Actions -> Actions.

An example: I've defined a new action which type is "ir.actions.report.xml" to output a special report for the sale.order form. I would like to replace the print button in the header of this form by one to launch my new action. I found the line : button name="print_quotation" string="Print" type="object" states="draft" class="oe_highlight" groups="base.group_user"

But what's next ? override with a new button ? Which is the button "type" I need to fill in my xml ?

Many thanks for your advices. Regards.

2

Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
4341
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 12/6/13, 8:29 AM

Hello Benoit,

You need to inherit the sale.order view in you custom module and then try the following code.

Following code will replace the button:

<button name="print_quotation" position="replace">
    <button name="%(your_action)d" string="Print" type="action" states="draft" class="oe_highlight"/>
</button>

After this, you need to update your module.

Thanks,

Serpent Consulting Services

Thank for your answer. After deep searching, that doesn't suit my needs. I will keep the button but just need to delete the default standard report defined in sale order module. I know how to add a new one but what about deleting the default report in code ???

Benoit COVILLE
on 12/7/13, 1:37 PM
1
Benoit COVILLE
On 12/6/13, 3:17 PM

Thank you for your answer.

After searching deep, I don't need to change the default button action. I must change the default report opened by the button.

Doing this manually is like : Configuration -> Actions -> Reports remove the 'standard' sale order for example and make my new report service name = sale.order

But the problem is that OpenERP will rollback my changes at each module update.

I can create a new module to define my report but how do I delete the entry brought by sale_order module ? : report auto="False" id="report_sale_order" model="sale.order" name="sale.order" rml="sale/report/sale_order.rml" string="Quotation / Order" usage="default"/>

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: 12/6/13, 7:26 AM
Seen: 3931 times
Last updated: 3/16/15, 8:10 AM