تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
12045 أدوات العرض

Hello All,

I'm trying to hide field in inventory 'invoicing policy' by inheritance but i'm getting error on terminal and when i'm hiding this group then it also show error " ValueError: Element '<group name="accounting">' cannot be located in parent view".

My code is below:


<record model="ir.ui.view" id="inventory_rental_order_form">
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="name">Inventory Rental Form</field>
<field name="model">product.template</field>
<field name="arch" type="xml">
<data>
<xpath expr="//notebook/page[@name='invoicing']/group[2]" position="replace" invisible="1">
</xpath>
<xpath expr="//field[@name='invoice_policy']" position="replace" invisible="1">
</xpath>
</data>
</field>
</record>


Thanks in advance

الصورة الرمزية
إهمال

Inheritance in model and view: https://goo.gl/4Zyc9d

أفضل إجابة

It's better not to replace fields, another view can use this field and you will get errors because Odoo cannot find the field in the view anymore. 

This would be the correct way to hide a field: 

<xpath expr="//field[@name='invoice_policy']" position="attributes">

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

</xpath> 

 

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
أغسطس 22
1916
1
يوليو 22
19455
0
أبريل 22
2593
3
سبتمبر 21
2792
0
سبتمبر 21
1704