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

Overriding Left Menu Items

By
Alex Gallien
on 8/11/14, 7:45 PM 2,930 views

Hi all, I have been trying to override the left menu item "Quotations" in the Purchases Module (making domain changes) and am having touble. I copied the code and inherited, but instead of overriding the menu item it creates a new menu item. Is there a way to just override it instead? This is what my code looks like currently:

     

        <record id="purchase_rfq" model="ir.actions.act_window">

            <field name="name">Quotations</field>

            <field name="type">ir.actions.act_window</field>

            <field name="inherit_id" ref="purchase.purchase_order_tree"/>

            <field name="res_model">purchase.order</field>

            <field name="context">{}</field>

            <field name="domain">[('state','in',('draft','sent','confirmed')),('origin','=','')]</field>

            <field name="view_mode">tree,form,graph,calendar</field>

            <field name="search_view_id" ref="purchase.view_purchase_order_filter"/>

            <field name="help" type="html">

              <p class="oe_view_nocontent_create">

                Click to create a request for quotation.

              </p><p>

                The quotation contains the history of the discussion/negociation

                you had with your supplier. Once confirmed, a request for

                quotation is converted into a purchase order.

              </p><p>

                Most propositions of purchase orders are created automatically

                by OpenERP based on inventory needs.

              </p>

            </field>

        </record>

        <menuitem action="purchase_rfq" id="menu_purchase_rfq"

            parent="purchase.menu_procurement_management"

            sequence="1"/>

Thanks Janeesh, your answer was very helpful. I had to change the menuitem action to purchase.purchase_rfq as well - but I understand inheritance in these situations better now.

Akbar Ali
on 8/13/14, 8:28 AM
5

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 8/12/14, 10:22 AM

Hi Alex,

You should override the menu by,

<record id="purchase.purchase_rfq" model="ir.actions.act_window"> 

instead of <record id="purchase_rfq" model="ir.actions.act_window">.

Because when you would create a record, it creates with module reference(Module Name+Existing ID), the new module having same record id will not override the menu.

Moreover if you want to change ONLY the DOMAIN you can only override the domain instead of the whole code. The concern is, whatever you want to override just change that part by inheriting the id. Like,

 <record id="purchase.purchase_rfq" model="ir.actions.act_window">

            <field name="domain">[('state','in',('draft','sent','confirmed')),('origin','=','')]</field>

</record>

Try this. Will work for sure.

Thanks.

This is perfect, thank you. That middle paragraph really helped cement some things for me that have been causing issues lately. One more question if you have a chance - I would like the domain for quotations to be anything that does not have a "Source Document". The worked for me, ('origin','!=',''), but for some reason ('origin','=','') does not pull up any results, even though I have some POs without Source Documents. Is there a better syntax for this? Thanks!

Alex Gallien
on 8/12/14, 3:27 PM

Scratch that, figured it out - ('origin','=', False) worked. Thanks again!

Alex Gallien
on 8/12/14, 3:33 PM
5

Janeesh

--Janeesh--
1641
| 4 3 4
Cochin, India
--Janeesh--

Odoo Developer

Janeesh
On 8/12/14, 5:20 AM

Hi,

There are two ways to implement this. Either override the action or override the menu.

If overriding the action, then change the id of action to 'purchase.purchase_rfq'. In this case no need to change anything in menu part. In second case, give any id to the action created by you. In this case id seems 'purchase_rfq'. Then in menu you have to write like this.         <menuitem action="purchase_rfq" id="purchase.menu_purchase_rfq"
            parent="menu_procurement_management"
            sequence="0"/>

1
Akbar Ali
On 8/13/14, 8:29 AM

Hi,

There are two ways to implement this. Either override the action or override the menu.

If overriding the action, then change the id of action to 'purchase.purchase_rfq'. In this case no need to change anything in menu part. In second case, give any id to the action created by you. In this case id seems 'purchase_rfq'. Then in menu you have to write like this.         <menuitem action="purchase_rfq" id="purchase.menu_purchase_rfq"
            parent="menu_procurement_management"
            sequence="0"/>

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

3 follower(s)

Stats

Asked: 8/11/14, 7:45 PM
Seen: 2930 times
Last updated: 3/16/15, 8:10 AM