Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
2859 มุมมอง

Is it possible to use an Extension View to inherit a base view, and replace multiple items via xpath?

For instance the following works fine:


But if I put:


Then it will error on save.

Validation Error

Error while parsing or validating view: Extra content at the end of the document, line 6, column 1



อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Enclose as many individual modifications as you need - all inside a data tag.




อวตาร
ละทิ้ง
ผู้เขียน

Thank you Ray I will give this a try.

คำตอบที่ดีที่สุด

Hi,

Yes, it's possible to use Extension Views in XML to inherit a base view and replace multiple items using XPath expressions. Your example demonstrates the use of XPath expressions within <xpath> tags to replace specific elements in the base view.

<template id="inherit_base_view" inherit_id="base.view">
    <xpath expr="//p[@id='powered']" position="replace"></xpath>
<xpath expr="//div[contains(@class, 'by_odoo')]/a[contains(@href,'https://www.odoo.com" rel="noopener nofollow noreferrer" target="_blank" data-saferedirecturl="https://www.odoo.com')]"" rel="ugc">https://www.google.com/url?q=https://www.odoo.com&source=gmail&ust=1715316861287000&usg=AOvVaw29BwovjeEHdvxU8dv10yVk">https://www.odoo.com')]" position="replace"></xpath>
</template>
<!-- Extra content -->

Make sure that your XML document only contains the necessary content within the expected structure. In this case, it seems like the extra content is placed after the closing tag of the template, which is not allowed.


Hope it helps

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
4
ก.ย. 20
6088
0
ส.ค. 21
3360
Help with XPath and View Inheritance แก้ไขแล้ว
4
ส.ค. 21
66996
0
พ.ค. 24
6899
1
พ.ย. 24
1605