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
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
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
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
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
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 :)
(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,
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
Hiding a page depends on condition
Đã xử lý
|
|
3
thg 2 17
|
17669 | |
|
2
thg 7 24
|
2649 | ||
|
1
thg 6 24
|
5126 | ||
|
0
thg 4 24
|
30 | ||
|
1
thg 10 23
|
10829 |