My moudlue inherited sale.order.I try to invisible commitment_date field and change the name of requested_date field.So I used xpth for both two fields.But both of fields occurred
Element '<xpath expr="//field[@name='requested_date'][not(ancestor::field)]">' cannot be located in parent view
Element '<xpath expr="//field[@name='commitment_date'][not(ancestor::field)]">' cannot be located in parent view
How can I fix these error?Thank You.
Following is my code;
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="sale_order_tree_view" model="ir.ui.view">
<field name="name">sale_order_tree_view</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_quotation_tree"></field>
<field name="arch" type="xml">
<xpath expr="//field[@name='requested_date']" position="attributes">
<attribute name="string">CW Dates</attribute>
</xpath>
<xpath expr="//field[@name='commitment_date'][not(ancestor::field)]" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
</record>
</data>
</odoo>
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Boekhouding
- Voorraad
- PoS
- Project
- MRP
Deze vraag is gerapporteerd
This is the correct code, put sale_order_dates in depends list on manifest
<record id="sale_order_tree_view" model="ir.ui.view">
<field name="name">sale_order_tree_view</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale_order_dates.view_quotation_tree_date"></field>
<field name="arch" type="xml">
<xpath expr="//field[@name='requested_date']" position="attributes">
<attribute name="string">CW Dates</attribute>
</xpath>
<xpath expr="//field[@name='commitment_date'][not(ancestor::field)]" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
</record>
Make sure that the fields commitment_date, requested_date are already in the parent view. If you are trying to add these fields as new fields to the view, use a pre-existing field that comes default with odoo in the xpath expression.
try the code
<xpath expr="//field[@name='commitment_date'] position="attributes">
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
AanmeldenGerelateerde posts | Antwoorden | Weergaven | Activiteit | |
---|---|---|---|---|
|
2
jul. 25
|
4471 | ||
|
2
dec. 24
|
7656 | ||
How to ORDER BY? [Odoo 10]
Opgelost
|
|
2
nov. 24
|
28421 | |
|
2
mei 24
|
7382 | ||
|
3
mrt. 24
|
6807 |
What is the use of [not(ancestor::field)]