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

find the edit/view state of a form view

S'inscrire

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

Cette question a été signalée
xmlformviewv7state
12 Réponses
28295 Vues
Avatar
HIGHCO - Nicolas Clavier

Hi, further to : a question I asked before I would like to know:

how can we deduct the state of a form (either edit or view mode) in xml view definition ?

I would like to use this information in a an attribute on field: example:

<field name="my_field" invisible="isTheViewInEditMode">
<field name="my_field" attrs="{'tree_invisible':[domain using isTheViewInEditMode]}">
3
Avatar
Ignorer
Avatar
René Schuster
Meilleure réponse

The Solution might be class="oe_edit_only".

<field name="yourfield" class="oe_edit_only"/>

This will hide the field, when view is in view mode. oe_edit_only also works for other design elements like labels, groups, etc..

3
Avatar
Ignorer
René Schuster

To achieve the opposite (hide in edit mode), the answer to this question is very helpful and works fine for me:

http://help.openerp.com/question/11853/inverse-of-css-class-oe_edit_only/

Avatar
Parth Gajjar
Meilleure réponse

First thing i can not understand well what you want to do but i try to do what i understood.

I add attrs field in sale order lines like this

<field name="discount" attrs="{'invisible':[('price_unit','=',0)]}" groups="sale.group_discount_per_so_line"/>

This means my discount field become invisible if price_unit = 0 And that's working See in image

image description

And if you wish user can see the field but can't edit then better use readonly attribute

Hope this will help you

1
Avatar
Ignorer
HIGHCO - Nicolas Clavier
Auteur

Hey Parth, Thanks for your answer, my goal is the following: in a listview child of a form view (one2many widget) I have one fields.text that holds a lot of text. Since there is no option to truncate the text shown when the whole form is in view mode, I did as advised in another post. I created a fields.function that returns a truncated version of my fields.text. Now, I want to have the fields.text to be visible in the listview when the form is in edit mode only, and the fields.function (truncated text) to be visible when the form is in view mode.

HIGHCO - Nicolas Clavier
Auteur

in the previous post mentionned in my question, someone advised setting the invisble attribute with invisible="context.get('set_editable',False)" but I found out that the set_editable key is not in the context. Therefore I want to clarify within this post : is there a way to find out in what state (edit|view) a form is at all ?

Parth Gajjar

Means you want to enable and disable whole column during switching between edit and saved mode .... I don't know about Is there a way to find out in what state (edit|view) a form is at all ?

But one other thing is pass class="oe_edit_only" this will disable field in saved mode and display that field in edit mode. but i never try that on one2many. Try it and see what happen

HIGHCO - Nicolas Clavier
Auteur

that was a good track at first but so far it has no effect. Though the css trick should be investigated. I actually tried it on a label and it didn't affect visibility, even though the class was on the dom element.

HIGHCO - Nicolas Clavier
Auteur

correction : it does work on a label, I had initially tested on a validated sale.order that could not be edited anymore, therefore not in edit mode. But on a draft sale.order it worked on a label. It still doesn't work on a table column though.

Parth Gajjar

Then there are 2 options .........

First made own widget(this is hard) .......

Second easiest way is use Jquery And JavaScript

For Local Jquery and javascript See this link Local CSS,JQuery and javascript in Openerp

HIGHCO - Nicolas Clavier
Auteur

ok, so no easy way then. Thanks for the help anw !

HIGHCO - Nicolas Clavier
Auteur

Back to this topic, I looked through the CSS but didn't spot a class that does the opposite like class="oe_browse_only" ... any hint ?

Avatar
Dr Obx
Meilleure réponse

Even a couple of years later I found it very useful. It still can help :)

Currently added an image which is overlapping product avatar but while editing record I couldn't add/change avatar because product avatar was covered by the image i added :)

So I was needed something to solve this issue. Right  after I added this class="oe_edit_only" overlapping image gets hidden so i can add/change product's avatar now :)


in edit mode:

in view mode:

"in stock"

in view mode:

"out of stock"


Thank you guys :)

0
Avatar
Ignorer
Atte Isopuro

I'd love to see some example code of this Dr Obx!

OdooBot
What do you mean ?
Example of what ?

On 27 July 2015 at 15:37, Atte Isopuro <atte.isopuro@web-veistamo.fi> wrote:

I'd love to see some example code of this Dr Obx!

--
Atte Isopuro
Sent by Odoo S.A. using Odoo about Forum Post False

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 show a field from parent object in view window ?
xml view v7
Avatar
Avatar
1
sept. 19
10051
xml view validate error ?
xml view v7
Avatar
Avatar
1
mars 15
11178
Is 'name' attribute in tag 'field' of value 'name' always required in v7 xml view ?
xml view v7
Avatar
0
mars 15
7602
Open form in view mode? Résolu
action xml form view
Avatar
Avatar
Avatar
Avatar
Avatar
4
déc. 21
33267
How to properly put field inside defined group without name
xml form view inherit
Avatar
Avatar
1
déc. 21
8550
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