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
    • Guest House
    • Distributeur de boissons
    • Hotel
    Real Estate
    • Real Estate Agency
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consulting
    • Accounting Firm
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Metal
    • Furnitures
    • Food
    • 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
    • Solar Energy Systems
    • Cordonnier
    • Services de nettoyage
    • HVAC Services
    Others
    • Nonprofit Organization
    • 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

How to create 2 form views for the same model?

S'inscrire

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

Cette question a été signalée
formformviewodoo16
2 Réponses
6234 Vues
Avatar
dariel
I am working in odoo 16 and I would like to make 2 form views for the same model where one is activated when I press the button to create a new instance and the other is activated when I click on the instance in the tree view to show some specific fields of the model . Can someone tell me if it is possible and if you can provide me with a similar example?


0
Avatar
Ignorer
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Meilleure réponse

Hi, we can create any number of views for same model with same mode, But we have to specify which view will be triggered in act_window records.


        <record id="action_account_journal_form" model="ir.actions.act_window">
            <field name="name">Journals</field>
            <field name="res_model">account.journal</field>
            <field name="view_mode">tree,kanban,form</field>
            <field name="view_ids" eval="[(5, 0, 0),
                (0, 0, {'view_mode': 'tree', 'view_id': ref('view_account_journal_tree')}),
                (0, 0, {'view_mode': 'kanban', 'view_id': ref('account_journal_view_kanban')}),
                (0, 0, {'view_mode': 'form', 'view_id': ref('view_account_journal_form')})]"/>
            <field name="help" type="html">
              <p class="o_view_nocontent_smiling_face">
                Add a journal
              </p><p>
                A journal is used to record transactions of all accounting data
                related to the day-to-day business.
              </p>
            </field>
        </record>

 

Here the view_ids Specifies the specific views to use for each view mode. The eval attribute indicates that this is a Python expression that will be evaluated:
(5, 0, 0): Clears existing view_ids.
(0, 0, {'view_mode': 'tree', 'view_id': ref('view_account_journal_tree')}): Adds a tree view with the reference view_account_journal_tree.
(0, 0, {'view_mode': 'kanban', 'view_id': ref('account_journal_view_kanban')}): Adds a kanban view with the reference account_journal_view_kanban.
(0, 0, {'view_mode': 'form', 'view_id': ref('view_account_journal_form')}): Adds a form view with the reference view_account_journal_form.

 

Hope it helps,

1
Avatar
Ignorer
Hayagreeva Aditya Kasibhotla

Very helpful. It worked for me. Thanks! 🫱🏻‍🫲🏻

Avatar
Deepa Venkatesh
Meilleure réponse

Well once you have 2 form views created

In the act window, you will need to write an exclusive form view to attach it, such that it is treated as primary view.

Example: you can refer Sale Order act window: action_orders


Then for calling a second form view from List, you can make use of context as follows:

context="{ 'form_view_ref': ...form2>'}" 


0
Avatar
Ignorer
Sachin M. Sonigra

This will work until the user does not refresh the page; if the user does that, then it will not open the custom view that you have passed via context.

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é
How to Resolve the "Inherited view cannot have 'Groups' defined on the record" Error in Odoo?
form inherit odoo16
Avatar
Avatar
1
août 24
2867
Detailed record view different then form view
form multiple formview
Avatar
0
juin 24
1881
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
How to Make an Entire Form View Readonly in Odoo 15? Résolu
form readonly formview v15
Avatar
Avatar
Avatar
2
juin 24
11980
How to open a form with ir.action.server which executes python code Résolu
python xml form formview
Avatar
Avatar
2
janv. 22
49615
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