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.

3

How to remove/hide the create button from an existing view in odoo9?

By
Sebin Siby
on 7/1/16, 4:56 AM 269 views

I want to remove/hide the create button from the POS orders view. I tried the following code but doesn't worked.

<record model="ir.ui.view" id="misc_view_pos_pos_form">

        <field name="name">misc.pos.order</field>

        <field name="model">pos.order</field>

        <field name="inherit_id" ref="point_of_sale.view_pos_pos_form"/>

        <field name="arch" type="xml">

                <xpath expr='//form' position='attributes'>

                        <attribute name="create">false</attribute>

                </xpath>

         </field>

</record>

I don't have any idea what I am doing wrong!!

1

Not your mistake but on pos.order action default show tree view not form view

and  you have done only on form view not on tree then you can show create button on tree.


i have added code try it.


FORM


<record model="ir.ui.view" id="misc_view_pos_pos_form">

<field name="name">misc.pos.order.form</field>

<field name="model">pos.order</field>

<field name="inherit_id" ref="point_of_sale.view_pos_pos_form"/>

<field name="priority">25</field>

<field name="arch" type="xml">

<xpath expr="//form" position="attributes">

<attribute name="create">false</attribute>

</xpath>

</field>

</record>


TREE


<record model="ir.ui.view" id="misc_view_pos_pos_tree">

<field name="name">misc.pos.order.tree</field>

<field name="model">pos.order</field>

<field name="inherit_id" ref="point_of_sale.view_pos_order_tree"/>

<field name="priority">25</field>

<field name="arch" type="xml">

<xpath expr="//tree" position="attributes">

<attribute name="create">false</attribute>

</xpath>

</field>

</record>

Same code as in the question above, and it doesn't worked

Sebin Siby
on 7/1/16, 5:59 AM

hello i have updated so you can try it

Prashant Panchal (ppa)
on 7/1/16, 6:07 AM

Thank you Prashant.

Actually I have done it on both form view and tree view. But I didn't set the priority field.

Now it's working fine and again thank you.

Sebin Siby
on 7/1/16, 6:24 AM
0
Roberto Barreiro
On 7/4/16, 5:52 AM

<xpath expr="//button[@name='create']" position="replace"/>

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: 7/1/16, 4:56 AM
Seen: 269 times
Last updated: 9/6/16, 9:49 AM