Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Food & Hospitality
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Guest House
    • Distribuidor de bebidas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consulting
    • Accounting Firm
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Trades
    • Handyman
    • Hardware y asistencia informática
    • Solar Energy Systems
    • Zapatero
    • Servicios de limpieza
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar 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
  • Proyecto
  • 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

Required fields problem in a model with different stages

Suscribirse

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

Se marcó esta pregunta
fieldsrequired
1 Responder
8162 Vistas
Avatar
rosey

I have five stages in hr.recruitment.

In each have many required fields.

I added required="true" in each field.

I added datas in the first stage & save. But it shows error that remaining stages required fields are empty.

I want the same procedure, But how can i solve the issue?

ie, Datas in the first stage added there, then save. Only when i click the second stage, required fileds of second stage give that time only.

After initial qualification, next first stage then second stage. In initial qualification both tab are invisible, when i click first stage the offer letter field should be required, when i click second stage the passport field should be required.

<page string="First Stage" attrs="{'invisible':[('state','=','draft')]}"> <group> <field name="offer_letter" required="1"/> </group> </page>

<page string="Second Stage" attrs="{'invisible':[('state','in',('draft','pending'))]}"> <group> <field name="passport" required="1"/> </group> </page>

0
Avatar
Descartar
Avatar
Ayyappan
Mejor respuesta

Try below one:

<field name="field_2" attrs="{'required':[('stage','=','two')]}"/>

If stage is in second, field_2(second field) must be in required. Otherwise should be in un-required state.


I have done the below code depends on state:

<page string="First Stage" attrs="{'invisible':[('state','=','draft')]}"> 
    <group> 
        <field name="offer_letter" attrs="{'required':[('state','=','draft')]}"/> 
    </group> 
</page>
<page string="Second Stage" attrs="{'invisible':[('state','in',('draft','pending'))]}"> 
    <group> 
        <field name="passport" attrs="{'required':[('state','=','pending')]}"/> 
    </group> 
</page>

In draft state: "offer_letter" field is required In pending state: "passport" field is required


In pyhton:

_columns = { 
'stage': fields.selection([
            ('stage_1', 'Start Qualification'),
            ('stage_2', 'First Qualification'),
            ('stage_3', 'Second qualification'),
            ('stage_4', 'Before finalisation'),
            ('stage_5', 'Finalised'),            
            ], 'Stage'
            ),
'field_1': fields.char('Field_1', size=64),
'field_2': fields.char('Field_2', size=64),
'field_3': fields.char('Field_3', size=64),
'field_4': fields.char('Field_4', size=64),
'field_5': fields.char('Field_5', size=64),
}
_defaults = {
        'stage': 'stage_1',     
        }

In xml:

<page string="First Stage"> 
    <group> 
        <field name="field_1" attrs="{'required':[('stage','=','stage_1')]}"/> 
    </group> 
</page>
<page string="Second Stage"> 
    <group> 
        <field name="field_2" attrs="{'required':[('stage','=','stage_2')]}"/> 
    </group> 
</page>  
<page string="Third Stage"> 
    <group> 
        <field name="field_3" attrs="{'required':[('stage','=','stage_3')]}"/> 
    </group> 
</page>  
<page string="Fourth Stage"> 
    <group> 
        <field name="field_4" attrs="{'required':[('stage','=','stage_4')]}"/> 
    </group> 
</page>  
<page string="Fifth Stage"> 
    <group> 
        <field name="field_5" attrs="{'required':[('stage','=','stage_5')]}"/> 
    </group> 
</page>

If you use like this, in your status bar consists 5 stages. Beginning of the flow stage is stage_1(Start Qualification) in this stage Field_1 is required, then when you click the stage_2(First Qualification) - Field_2 is required..., and the flow goes likewise.

0
Avatar
Descartar
Remya

Uncaught Error: Unknown field stage in domain [["stage","=","two"]]. Its shows the error

Ayyappan

Above i just gave example code. If you need full functionality code, give me your files or fields details.

Remya

i updated my question, please check it.

Remya

Any solution?

Ayyappan

Can you please explain the stage? I think state field is stage. Here i explain with state.

Remya

Ok its working.

rosey
Autor

Still have a doubt. I have three stage with same status type. ie, third stage, fourth stage, fifth stage. each three is status=hired. But each three stage has different fields. What will do? Please reply

Ayyappan

In same state it is not possible. You just add another two states. Otherwise in hired state all remaining fields will be in required state.

rosey
Autor

But my requirement is that. What will do? Any way to solve this?

Ayyappan

After second stage what you want to do? Give a summary of your work. Otherwise how can i help you. In the beginning of the third stage you want one field should be required. right? and you will save the form another field should be required. is it correct?

rosey
Autor

I'll explain you. I have 5 stages. In each stage i have some required field. First stage status=draft, 2nd,3rd are pending, 4th,5th are hired. In 2nd stage i have three required fields and in 3rd stage 5 required fields. same as in 4th&5th. How can i update my code? <field name="passport" attrs="{'required':[('state','=','pending')]}"/> if i give like this, it will affect 2nd & 3rd, right?

Ayyappan

What is the difference between 2nd & 3rd stage, and 4th & 5th stage? How do you mention it is 2nd and 3nd stage? Is there any process between 2nd and 3rd?

rosey
Autor

Yes. Stage names are different. 2nd=First Qualification---here we check some details and add it. if he qualified. then goes to 3rd=Second qualification---here we add some other details of the candidate. 4th=Before finalisation---here we add salary details. 5th=Finalised---here add bank details &some datas.

rosey
Autor

Both the 2nd&3rd 4th&5th different. Only status is same. 2nd&3rd-pending. 4th&5th-hired.

Ayyappan

Ok. Here you have mentioned "First Qualification", "Second qualification", "Before finalisation", "Finalised". right? Is there any field to get this value? How the process goes to "Second qualification" from "First Qualification"? Do you click any button to change the stage?

rosey
Autor

On status bar in the hr.applicant

Ayyappan

In status bar look like this? First Qualification>Second qualification>Before finalisation>Finalised. Is it selection field?

rosey
Autor

Just like that.

Ayyappan

Give me the status bar field name and what are the fields you want to hide in the particular state.

rosey
Autor

it is a large portion, and is with my senior. i just want to find out a solution for this. Can you just image some fields,please?

Remya

It is fine. Another help. How can i hide a <page> string like this? I have five page tab in the same <notebook>. 1st page is seen in stage_1=draft. 2nd page is seen i stage_2=pending. 3nd page is seen i stage_3=pending. 4th page is seen in stage_4=hired. 5nd page is seen i stage_5=hired. Stage names are same as above. Can you please suggest any code?

Ayyappan

Hi Remya, I want to know about stage and state. is it same field? or different field? Do you mention a state is stage?

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

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

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Required Fields in view Kanban Odoo13
fields required kanban_state
Avatar
0
jun 22
2378
Skipping required fields
fields one2many required
Avatar
Avatar
1
oct 19
5725
how to make a field compulsory only at a certain stage odoo Resuelto
fields help required
Avatar
Avatar
Avatar
3
abr 18
5894
How to display a red * for required fields
fields
Avatar
Avatar
Avatar
Avatar
3
may 25
3203
How to display a red * for required fields
fields
Avatar
Avatar
1
abr 25
2309
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información 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 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