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

Add js_class attribute to an existing view.

S'inscrire

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

Cette question a été signalée
extensionformviewodoo12
1 Répondre
8662 Vues
Avatar
kylesentient@gmail.com

I created an extension of the form view that adds a button to the toolbar similar to the HelloworldEvolution view from this video here: 

https://www.youtube.com/watch?v=SIoljYJhTqk

Github repo for the video:

https://github.com/Polymorphe57/hello_world_view_code

The extension just adds a button to the toolbar that doesn't do anything yet. Now I'd like to use this extension in an existing view, like the stock.picking form view from the Inventory app.

I tried inheriting the view and adding the js_class attribute to it using:

<xpath expr="//form" position="attributes">
    <attribute name="js_class">my_formview_extension</attribute>
</xpath>

But nothing gets added to the form. No error is thrown either. Anyone can help?

Thanks!

0
Avatar
Ignorer
Avatar
La Jayuhni Yarsyah
Meilleure réponse

Hi,,

Its clearly described in the repository that "This repository contains the code of the hello world view that was presented at the Odoo Experience 2018 during the talk entitled "Visualizing Data in Odoo: How to Create a New View" , you can clearly read at  https://github.com/Polymorphe57/hello_world_view_code/blob/master/README.md

It create new type of view!

But based on your syntax,, you try to use in "FORM" view,, it wouldn't be executed!

1
Avatar
Ignorer
kylesentient@gmail.com
Auteur

Then my wording must have been unclear, and I apologize for that. What I meant to say was that I used some of the references from that video to create an extension of the form view, similarly to the HelloWorldEvolution extension that the developper in the video created for the HelloWorld View. I did not create a helloworld view, I extended the Form View to add a couple buttons to it.

La Jayuhni Yarsyah

I think it can do by add button on form header in xml (for simple ways)

Ex:

<xpath expr="//form/header">

<button name="ex_btn_action" type="object" string="EXAMPLE BUTTON" />

</xpath>

and if you wanna to no action when clicked,, you just only need to define method in python that only just return False/None Value

Ex:

def ex_btn_action(self):

return None

But if you wanna advanced way to add button at the toolbar and wanna to apply to all form view ,, you must inherit odoo web js class "web.FormRenderer"

How to inheriting js class, you can read here as reference:

https://www.odoo.com/documentation/11.0/reference/javascript_cheatsheet.html#modifying-a-main-widget-from-the-interface

https://odoo-development.readthedocs.io/en/latest/dev/pos/gui.html

Regards

La Jayuhni Yarsyah

sorry miss for the example

<xpath expr="//form/header" position="inside">

<button name="ex_btn_action" type="object" string="EXAMPLE BUTTON" />

</xpath>

kylesentient@gmail.com
Auteur

Thank you, Yarsyah. I'll be sure to try all of these things and see which one fits my needs best :)

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é
form view was changed when reloading the page
formview odoo12
Avatar
Avatar
2
juil. 22
1494
Inhrit models and display in new form view
formview odoo odoo12
Avatar
Avatar
Avatar
3
déc. 19
3454
Create new record by opening a new form on a button click Résolu
form button formview odoo12
Avatar
Avatar
Avatar
2
juil. 23
784
Display multiple views at a time
formview odoo10 odoo11 odoo12
Avatar
0
déc. 19
5344
How do I select the parent record automatically when I open the form-view created by a one2 many relationship? Résolu
one2many formview one2many_list odoo12
Avatar
Avatar
1
juil. 19
5572
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