Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

how to delete a page in form view?

By
amina
on 12/8/15, 11:23 AM 970 views

I have created a module that allows me to add some fields in a new page and now in the same xml file i tried to delete another existing page but it gives me the error that the View inheritance may not use attribute 'string' as a selector.

to specify what i want to delete it's the Inventory page of product.product_template_form_view
here is my code using the xpath expression

<record id="view_product_form_inherit" model="ir.ui.view">
     <field name="name">product.template.common.form.inherit</field>
     <field name="model">product.template</field>
     <field name="inherit_id" ref="product.product_template_form_view"/>
     <field name="arch" type="xml">
     	
      <data><xpath expr="//page" position="after">
      	<page name="Sample" string="Caractéristiques">
            <group>
                
                <field name="etat"/>
                <field name="famille"/>
                <field name="description"/>
                <field name="nb_pierre"/>
                <field name="carrat"/>
                <field name="datevt"/>
           </group>
        </page>
      </xpath>
	  <xpath expr="//page[@string='Inventory']" position="replace"/>
	  
	  
     </data></field>
    </record>

 ParseError: "Invalid view definition

Détails de l'erreur :
View inheritance may not use attribute 'string' as a selector.

1
Andre de Kock
On 1/29/16, 5:37 AM

Adding on what Axel Mendoza said. You would thus use an Xpath expression such as:

<xpath expr="//page[1]" />

Where the "1" is the *first* page on the form view.

0

Axel Mendoza

--Axel Mendoza--
10205
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 12/8/15, 1:14 PM

Hi @amina

In Odoo v9 you cannot use string attribute in your xpath selector expression, you need to switch to another attribute to identify the node or change the xpath expression style like found the nodes by position, but not using the string attribute because it will returned translated so you don't have an static value to compare with

0
amina
On 12/9/15, 4:59 AM

following what you said Axel Mendoza it gaves me the error that the attribut i used can not be located in view parent, I used attribut 'name' which i have added  in the base module because that page doesn't have any attribute other than string,please Axel am I doing something wrong here??

worked with Andre's proposition but now it's giving this error 

error
AttributeError: element '<div name="weight">' cannot be located in view parent

Contexte de l'erreur :
Vue `product.template.stock.property.form.inherit`
[view_id: 833, xml_id: stock.view_template_property_form, model: product.template, parent_id: 303]

this base module 'sale' which my module inherits from is related to the inventory module so I don't know if I really can delete this page from thid view without modifing base module

amina
on 12/9/15, 6:29 AM

@Andre answer and mine what tells you is that the original xpath will not work and you need to change it, if you try the @Andre way and another error shows up means that xpath works. You need to provide more info about the error

Axel Mendoza
on 12/10/15, 10:04 AM

don't have enough karma to delete this comment it's not well posted

amina
on 12/10/15, 12:44 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/8/15, 11:23 AM
Seen: 970 times
Last updated: 1/29/16, 5:37 AM