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

statusbar refuses to be colored

Suscribirse

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

Se marcó esta pregunta
stagesstatestatusbar
3 Respuestas
16909 Vistas
Avatar
Muszik Adrián

In my custom module i have this field:

'stage_id': fields.selection([
        ('draft', 'Draft'),
        ('final', 'Final'),
        ('modified', 'Modified'),
        ], 'Status',
        help="Contract Status", track_visibility='onchange'),

and in the XML view:

<header>
    <button name="action_final" attrs="{'invisible': [('stage_id', '!=', 'draft')]}" type="object" string="Final" class="oe_highlight"/>
    <button name="action_modified" attrs="{'invisible': [('stage_id', '!=', 'final')]}" type="object" string="Modified" class="oe_highlight"/>
    <field name="stage_id" widget="statusbar"  statusbar_visible="draft,final,modified"  statusbar_colors='{"draft":"red","final":"blue"}'/>
</header>

and yet my statusbar widget refuses to be colored on any stage. I am trying to use stage_id as states, thought.

or am i using states in a wrong way?

6
Avatar
Descartar
Avatar
Jordan Vrtanoski
Mejor respuesta

Check the following post: ../question/2154/how-to-add-a-new-value-to-a-selection-field-state-in-saleorder/

If you still have problem with the colour, check if the same field (in your case 'state') appears twice in the form. If this is the case, the widget "statusbar" won't display the colour properly.

5
Avatar
Descartar
Avatar
ZEeineb
Mejor respuesta

Hi Adrian,

Try to define a default value for your custom selection field on the python class. Here an example:

 _defaults = {  
        'stage_id': 'draft',
        }
1
Avatar
Descartar
Aaron Neo

Hi there, I have the same problem. The states just simply refuse to be colored. I have set _defaults for my state but it still does not get colored. Anything else that I am missing?

Aaron Neo

Hi there, I have the same problem. The states just simply refuse to be colored. I have set _defaults for my state but it still does not get colored. Anything else that I am missing?

ZEeineb

Hi Aaron Neo, could you post your code here please like Adrian?

Avatar
Aaron Neo
Mejor respuesta

Hi ZEeineb,

I attach my code here.

class Asset(osv.osv):
_name = "asset"
_description = "Asset (MRO of Assets)"
_inherit = "product.product"
_columns = {
        'deployed': fields.boolean('Deployed'),
        'asset_deploy_address': fields.one2many('asset_deploy_address', 'asset_id', 'Deploy Address'),
        'current_customer': fields.related('asset_deploy_address', 'address_id', 'customer_id', 'name', type='char', string='Customer'),
        'current_location': fields.related('asset_deploy_address', 'address_id', 'name', type='char', string='Location'),
        'current_address': fields.related('asset_deploy_address', 'address_id', 'address', type='char', string='Address'),
        'stage': fields.selection([
            ('new', 'Draft'),
            ('deploy', 'Deploy Asset'),
            ('complete', 'Completed'),              
            ],'Status', readonly=True, select=True, help='Workflow stages'),
        }
_defaults = {
        'deployed':False,
        'stage':'new',
        }

After much investigation, I found out that it is due to inheriting product.product model. Because product.product already has "state" fields, so specifying my own "state" field would add-on to it. However, states are still not being colored in the statusbar widget. I didn't have the energy and time to read into the source code of OpenERP base to find out the root cause.

In the end, my solution is to change my "state" field to "stage". Then in my view (XML) i used "attrs" attribute to hide buttons by detecting the value of "stage" field element. See code below.

<record model="ir.ui.view" id="asset_form_view">
        <field name="name">asset.form.view</field>
        <field name="model">asset</field>
        <field name="type">form</field>
        <field name="priority" eval="1"/>
        <field name="inherit_id" ref="product.product_normal_form_view"/>           
        <field name="arch" type="xml">
            <sheet position="before">
                <header>
                    <button name="specify_holding_wh" string="Specify holding warehouse" attrs="{'invisible':['|',('stage','=','deploy'),('stage','=','complete')]}"/>
                    <button name="specify_holding_wh_repeat" string="Specify holding warehouse" attrs="{'invisible':['|',('stage','=','new'),('stage','=','complete')]}"/>
                    <field name="stage" widget="statusbar" statusbar_visible="new,deploy,complete" statusbar_colors='{"new":"red","complete":"blue"}'/>
                </header>
            </sheet>

This workaround works pretty well. My "stage" statusbar widget now gets colored and buttons show and hide as desired. If you know how to solve the inherited "state" field problem, let tell me how. Thanks!

Regards, Aaron

1
Avatar
Descartar
¿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 change the order of status bar states in Odoo 18 after adding a new state, without override the field?
state statusbar Selection selectionfield
Avatar
1
ene 25
4984
Automaticaly creating the stages when module will be install Resuelto
stages enterprise statusbar v14
Avatar
Avatar
1
ene 24
2133
state selection field doesn't accept new default value (odoo 12) Resuelto
selection state statusbar odooV12
Avatar
Avatar
Avatar
4
may 19
13279
State statusbar in form view alligns left
xml state statusbar helpdesk
Avatar
Avatar
1
mar 15
7915
[SOLVED] How to modify "State" when create "Sale Order" in module "Sale"
state statusbar sale.order sale.sale
Avatar
Avatar
2
mar 15
7241
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