Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
3 Răspunsuri
4514 Vizualizări

I know that on v10 and v11 cannot use string as an identifier string for xpath, in "purchase.order form" there are 2 pages of Product and Deliveries & Invoices. I tried page [2] but didn't work, currently I leave the page [2] / group, then the page groups are gone. So what is the new method to hide the page? thanks for all sharing

Imagine profil
Abandonează
Cel mai bun răspuns

HI Vu,

You can hide/remove a page by calling it by the name:

<xpath expr="//page[name='the_page_name']" position="inside">
    <!-- Your code here to add custom logic -->
</xpath>


<!-- Or to remove the page -->
<xpath expr="//page[name='the_page_name']" position="replace"/>

If your page has no name set your only option is to use xpath expressions with an index (so page[2]). Don't forget that xpath expressions start counting from 0 and not 1:

<xpath expr="//page[2]" position="inside">
    <!-- Your code here to add custom logic -->
</xpath>


<!-- Or to remove the page -->
<xpath expr="//page[2]" position="replace"/>

You can find quite some xpath expressions that look much like what you need in the code. Have a look at https://github.com/odoo/odoo/search?l=XML&q=%3Cxpath+expr%3D%2F%2Fpage for quite some examples.

Regards,
Yenthe

Imagine profil
Abandonează
Autor

Hi, Yenthe,

The form has 2 pages. As mentioned above, when page [1], the page product is hidden, ie the index starts from 1, but [2] cannot, ?? - inside does not work, unfortunately because there is no "name". I also tried xpath on "name" for page [2] and then made it hidden by page [name = 'the_page_name'] but failed. I don't understand what this page is special about. although it does not inherit from any other form

Cel mai bun răspuns

Hello @Vu,

As you know  that on v10 and v11 cannot use string as an identifier string for x-path,


Thanks for the answer @yenthe and it works in common views

But In this conditions, 

we have notebook  inside page and page inside addons have added another notebook and pages in purchase(Product page) view 

- so when we have tried using page[2] and other ways it's always taken the first page inside notebook pages


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

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

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

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

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

                <xpath expr="//sheet/notebook" position="attributes">

                    <attribute name="name">orderline_notebook</attribute>

                </xpath>

                <xpath expr="//sheet/notebook[@name='orderline_notebook']/page[2]" position="replace"/>

            </field>

    </record>

Regards,




Email: odoo@aktivsoftware.com

Skype: kalpeshmaheshwari

   

Imagine profil
Abandonează
Autor

Hi, aktivsoftware Great, i have tried before: xpath name = "name" like yours and then continue inherit the custom form again. but failed, once again thanks for this solution.

Never noticed that, odd design decision :)

Autor

(y) I do not understand why I did not add the attribute name = "_ name_page" to some pages of the base, or it was a missing error,

Related Posts Răspunsuri Vizualizări Activitate
3
feb. 17
17669
2
iul. 24
2649
1
iun. 24
5126
0
apr. 24
30
1
oct. 23
10827