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
    Restauration & Hôtellerie
    • 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
    • Brasserie
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Commerce
    • Bricoleur
    • Matériel informatique & 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
    Parcourir toutes les 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 pour partenaires
    • 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

add a field in a tree view

S'inscrire

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

Cette question a été signalée
fieldinheritaddxpathbugs
4 Réponses
25714 Vues
Avatar
Aziz Adi Nugroho

i'm trying to replace a field in a treeview ... help me please

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

<field name="name">project.task.form.inherited</field>

<field name="model">project.task</field>

<field name="inherit_id" ref="project.view_task_form2" />

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

<field name="project_id" position="attributes">

<attribute name="on_change">onchange_project(project_id)</attribute>

</field>

<field name="tag_ids" position="after">

<field name="analytic_account_id" invisible="1"/>

<field name="progress" widget="progressbar"

groups="project.group_time_work_estimation_tasks"/>

</field>

<xpath expr="//notebook/page[@name='description_page']" position="after">

<page string="Timesheets" groups="project.group_tasks_work_on_tasks,project.group_time_work_estimation_tasks">

<field name="timesheet_ids" groups="project.group_tasks_work_on_tasks" context="{'default_account_id' : analytic_account_id, 'default_is_timesheet' : 1}">

<tree editable="top" string="Timesheet Activities">

<field name="date"/>

<field name="user_id" required="1"/>

<field name="name"/>

<field name="account_id"/>

<field name="unit_amount" string="Duration" sum="Total time" widget="float_time"/>

<field name="is_timesheet" invisible="1"/>

</tree>

</field>

<group>

<group class="oe_subtotal_footer oe_right" name="project_hours" groups="project.group_time_work_estimation_tasks">

<field name="effective_hours" widget="float_time" groups="project.group_time_work_estimation_tasks"/>

<field name="remaining_hours" widget="float_time" class="oe_subtotal_footer_separator" groups="project.group_time_work_estimation_tasks"/>

</group>

</group>

</page>

</xpath>

</field>

</record>


i want add new field inside "timesheet_ids", 

this is my custom script on _view.xml


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

<field name="name">project.task.view.form</field>

<field name="model">project.task</field>

<field name="inherit_id" ref="project.view_task_form2"/>

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

<xpath expr="/notebook/page[@name='description_page']" position="before">

<page string="Timesheets" groups="project.group_tasks_work_on_tasks,project.group_time_work_estimation_tasks">

<field name="timesheet_ids" groups="project.group_tasks_work_on_tasks" context="{'default_account_id' : analytic_account_id, 'default_is_timesheet' : 1}">

<tree editable="top" string="Timesheet Activities">

<field name="date"/>

<field name="user_id" required="1"/>

<field name="name"/>

<field name="unit_amount" string="Duration" sum="Total time" widget="float_time"/>

<field name="is_timesheet" invisible="1"/>

<field name="invoiceable_analytic_line"/>

</tree>

</field>

</page>

</xpath>

</field>

</record>


but it's not work, why ? please help me and give me solution

Thanks


Aziz Adi Nugroho from Indonesia

1
Avatar
Ignorer
Avatar
Sehrish
Meilleure réponse

You can add a new field in tree view usig view inheritance. The purpose of inheritance or why we need inheritance is given below:

  1. To change attributes of some fields which exists on existing/custom model (e.g. making fields readonly,invisible)

  2. To add/modify/delete old or new fields in existing/custom model (e.g. Product, Sales, HR, Fleet Management, Attendance modules model etc)

  3. We can also add buttons in already existing/custom model (form and tree) view by using inheritance

Get complete code of view and model inheritance: http://learnopenerp.blogspot.com/2018/01/inheritance-in-models-and-views.html

1
Avatar
Ignorer
Sehrish

To add new field in tree view you need to inherit tree view of parent view:

http://learnopenerp.blogspot.com/2018/01/inheritance-in-models-and-views.html

Thanks

Avatar
Daniel Sudrata
Meilleure réponse

Hi Aziz, are you interested to become one of our team in Indonesia?

0
Avatar
Ignorer
Avatar
ayman mohammed adam
Meilleure réponse

Hi,

please try this code

<xpath expr="//notebook/page[@string='Timesheets']/

timesheet_ids/tree/field[@name="is_timesheet"]" position="after">

<field name="invoiceable_analytic_line"/>

</xpath>

0
Avatar
Ignorer
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é
Can't use xpath while inheriting crm.lead form view
form view field inherit xpath
Avatar
Avatar
1
mars 15
7018
How can I add a field in sale.order.line Résolu
field add
Avatar
Avatar
Avatar
2
déc. 22
8985
Is it possible to use xpath in a qweb template WITHOUT to inherit an other template? Résolu
inherit xpath
Avatar
Avatar
1
sept. 15
5865
odoo 15 to odoo 16 error while upgrading the app
inherit xpath odoo
Avatar
Avatar
Avatar
2
mars 24
2704
[v14] Is it possible to see the xml code with the changes made by an Xpath? Résolu
field xpath result
Avatar
Avatar
2
mai 21
3878
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