Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

Weird error "Expression cannot be located in parent view" in view inheritance

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
viewinheritance
1 Répondre
7913 Vues
Avatar
Raffaele

In v9 I'm trying to add a smart button to the partner form. I copied the code from the sale module, at https://github.com/odoo/odoo/blob/9.0/addons/sale/res_partner_view.xml#L38

The original code is: 

<record id="res_partner_view_buttons" model="ir.ui.view">
<field name="name">res.partner.view.buttons</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="priority" eval="20"/>
<field name="groups_id" eval="[(4, ref('base.group_sale_salesman'))]"/>
<field name="arch" type="xml">
<div name="button_box" position="inside">
<button class="oe_stat_button" type="action" name="%(sale.act_res_partner_2_sale_order)d"
attrs="{'invisible': [('customer', '=', False)]}"
icon="fa-usd">
<field string="Sales" name="sale_order_count" widget="statinfo"/>
</button>
</div>
</field>
</record>


I fitted it to suit my needs

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

<field name="name">res.partner.view.buttons</field>

<field name="model">res.partner</field>

<field name="inherit_id" ref="base.view_partner_form" />

<field name="priority" eval="20"/>

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

  <div name="buttons" position="inside"

<button class="oe_inline oe_stat_button" type="action" string="Cycles"

name="medical_report_basic.act_res_partner_2_cycle"

icon="fa-repeat" help="Manage patient's cycles">

</button> 

</div>

</field>

</record>

The system keeps complaining that 

Element '<div name="buttons">' cannot be located in parent view

I changed it to 

<xpath expr="(//sheet/div)[last()]" position="before">

<div class="oe_right oe_button_box" name="cycle_buttons">

<button class="oe_inline oe_stat_button" type="action" string="Cycles"

name="medical_report_basic.act_res_partner_2_cycle"

icon="fa-repeat" help="Manage patient's cycles">

</button>

</div>

</xpath>

And it is working fine - but it is a weird solution.

Why is the sale module code not working for me?

0
Avatar
Ignorer
Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Meilleure réponse

Hello Raffaele,

The <div name="buttons" you are trying might not exists in parent view.

Better to try with following code:

<div name="button_box" position="inside">
...add your fields...
</div>

5
Avatar
Ignorer
Raffaele
Auteur

Actually, looking at the Fields View Get, the <div name="buttons"> does not exist at all. There is <div name="button_box"> instead

Thank you!

Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
View inheritance Résolu
view inheritance
Avatar
Avatar
1
mars 20
4360
How do I remove fields from a view in a custom module? Résolu
view inheritance
Avatar
Avatar
Avatar
Avatar
12
déc. 18
36187
Problem with inheritance of a view. Résolu
view inheritance
Avatar
Avatar
1
mars 15
8705
Is "search + use arch" the right way to derive a form ?
view inheritance
Avatar
0
mars 15
4571
view inheritance in openerp
view inheritance
Avatar
Avatar
1
mars 15
4349
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now