Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

find the edit/view state of a form view

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
xmlformviewv7state
12 Respuestas
28322 Vistas
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
Descartar
Avatar
René Schuster
Mejor respuesta

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
Descartar
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
Mejor respuesta

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
Descartar
HIGHCO - Nicolas Clavier
Autor

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
Autor

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
Autor

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
Autor

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
Autor

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

HIGHCO - Nicolas Clavier
Autor

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
Mejor respuesta

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
Descartar
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

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
how to show a field from parent object in view window ?
xml view v7
Avatar
Avatar
1
sept 19
10095
xml view validate error ?
xml view v7
Avatar
Avatar
1
mar 15
11199
Is 'name' attribute in tag 'field' of value 'name' always required in v7 xml view ?
xml view v7
Avatar
0
mar 15
7611
Open form in view mode? Resuelto
action xml form view
Avatar
Avatar
Avatar
Avatar
Avatar
4
dic 21
33334
How to properly put field inside defined group without name
xml form view inherit
Avatar
Avatar
1
dic 21
8598
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

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