Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
9 Trả lời
3953 Lượt xem

Hello. After migrate from odoo 10 to odoo 12 I have this error. In odoo this this code worked fine

====================================

<record model="ir.ui.view" id="module_form">
<field name="name">module module form</field>
<field name="model">module.module</field>
<field name="arch" type="xml">
<form>
<header>

</header>
<sheet>
<notebook>
<field name='test'>
</notebook>
</sheet>
</form>
</field>
</record>


<record model="ir.ui.view" id="module_form_for_manager">
<field name="name">module module form for manager</field>
<field name="model">module.module</field>
<field name="inherit_id" ref="module.module_form"/>
<field name="groups_id" eval="[(4, ref('module.group_module_manager'))]"/>
<field name="arch" type="xml">
<xpath expr="//notebook" position="replace"></xpath>
</field>
</record>


Error : ValueError: Element '<xpath expr="//notebook">' cannot be located in parent view

==================================

Please help me solve this problem

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Oh. Forgive me for misleading you. Module name is my personal module. This is not a basic module.


For ease of understanding, I renamed



<record model="ir.ui.view" id="creative_form">
<field name="name">creative creative form</field>
<field name="model">creative.creative</field>
<field name="arch" type="xml">
<form>
<header>

</header>
<sheet>
<notebook>
<field name='test'>
</notebook>
</sheet>
</form>
</field>
</record>


<record model="ir.ui.view" id="creative_form_for_manager">
<field name="name">creative creative form for manager</field>
<field name="model">creative.creative</field>
<field name="inherit_id" ref="creative.creative_form"/>
<field name="groups_id" eval="[(4, ref('creative.group_creative_manager'))]"/>
<field name="arch" type="xml">
<xpath expr="//notebook" position="replace"></xpath>
</field>
</record>


Error : ValueError: Element '<xpath expr="//notebook">' cannot be located in parent view

Ảnh đại diện
Huỷ bỏ

Syntax seems okay. Check whether the first view is getting created before the second one.

Tác giả

how can I check it? In the code, the block with Xpath is below the main block. Both blocks in one xml file

Comment out the second block by putting a <!-- before, and a --> after the block like so and upgrade your custom module to see if the the first view is getting created correctly.

<!--

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

<field name="name">creative creative form for manager</field>

<field name="model">creative.creative</field>

<field name="inherit_id" ref="creative.creative_form"/>

<field name="groups_id" eval="[(4, ref('creative.group_creative_manager'))]"/>

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

<xpath expr="//notebook" position="replace"></xpath>

</field>

</record>

-->

Câu trả lời hay nhất

Hi,

Please try with 

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

and make sure that the notebook is not inherited in other views.

Thanks


Ảnh đại diện
Huỷ bỏ
Tác giả

This doesn't work either =(

Please check is there any other view with same record Id

module_form

Tác giả

No. This only one. This code worked fine in odoo 10

Is it possible to upgrade the respective module without this code

Tác giả

Hello. check out my today comment. I misled you with my module name ((

Tác giả

yes. Without this code my custom module correctly loaded

could you try with changing attributes instead of replacing

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

<attribute name="invisible">1</attribute>

</xpath>

Tác giả

Element '<xpath expr="//sheet/notebook">' cannot be located in parent view

Câu trả lời hay nhất

Hi Mikhail: There is no view with an external id of module.module_form in Odoo 12. There is one with an external id of base.module_form 

EDIT: 

Screenshot of base.module_form


Ảnh đại diện
Huỷ bỏ
Tác giả

No , error : "External ID not found in the system: base.module_form"

I have edited my earlier post and added a screenshot of base.module_form for your reference.

If it does not exist, it may indicate that the migration is not handling the views correctly.

Tác giả

Sorry ... check out my comment today ((

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 3 15
6878
1
thg 5 25
97656
1
thg 9 15
4716
0
thg 3 15
4053
1
thg 3 15
5886