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

Button That redirect to new form

Suscribirse

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

Se marcó esta pregunta
buttonsformsredirectodooV12
2 Respuestas
10382 Vistas
Avatar
Ali Mahmoud

Hi, 

i have a model called shift with status field, it can be open or closed, and it has a field called closing balance 

i want to create a button (close shift) that will be shown in tree view of the shifts, and when i click on it i should go to a form that will ask me to fill closing balance for this shift and when i click save the status of the shift will be changed to closed

Any when can help me please or give some guidelines for how to create this form and button and i will be thankful 

2
Avatar
Descartar
Avatar
Vishnu Vanneri
Mejor respuesta
Please try this

@api.multi

def close_shift(self):

name = _('Close Shift')

view_mode = 'tree,form'

return {

'name': name,

'view_type': 'form',

'view_mode': view_mode,

'res_model': 'Your Model Name',

'type': 'ir.actions.act_window',

'target': 'current',

}

if you want to specify which shift then you can pass it by res_id tag in it.
1
Avatar
Descartar
José Moreno Hanshing

Hello, I am getting the following error in V13

werkzeug.exceptions.BadRequest: 400 Bad Request: <function Home.web_client at 0x7f1fb58217b8>, /web: Function declared as capable of handling request of type 'http' but called with a request of type 'json'

My function is

def open_child(self):

return {

'type': 'ir.actions.act_window',

'name': 'Child',

'view_type': 'form',

'res_model': self._child_model,

'res_id': self._child_id,

'view_mode': 'form',

'views': [(False,'form')],

'target': 'current',

}

Can you help me with this please?

Vishnu Vanneri

Did you applied @api.multi decorator in open_child function?

José Moreno Hanshing

That decorator does not exist in V13, but I will try to debug around that to see what "self" actually is

Vishnu Vanneri

Are you accessing through controller?.

José Moreno Hanshing

@Vishnu Vanneri well it turned out to be a logic error on my side. The self._child_id and model were not set and I was hiding the button with the opposite logical rule. After using the button on the correct records it works fine. Thanks your your reply :)

Avatar
Thayif kabir
Mejor respuesta

Hi Ali,

You can return action in your button and redirect it any form view you want,

for example refer this code


return {             'name': 'name',
                    'view_type': 'form',
                    'view_mode': 'form',
                    'view_id': [res_id],
                    'res_model': 'model_id',
                    'context': "{}",
                    'type': 'ir.actions.act_window',
                    'nodestroy': True,
                    'target': 'current',     
                     }
pass the view_id to load specific form. if you need a pop up window you can give target = 'new'.
0
Avatar
Descartar
Ali Mahmoud
Autor

Thanks but what do you mean by inv_id? what does it represent ?

Thayif kabir

I've updated my answer, res_id is used when you need load a specific record in that model. You can pass model_id as res_id if you want to load a specific model

¿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
Make 'continue' button used at each kanban step in form Resuelto
buttons kanban forms v14
Avatar
Avatar
2
feb 21
3181
How to create the action of the buttons Odoo Community Version 12 ? Resuelto
action xml urgent buttons odooV12
Avatar
1
abr 19
12413
"Starting a business and looking for a free form builder - any recommendations?"
forms
Avatar
Avatar
1
jun 24
3634
Data Exceeded error while importing data in Odoo v12 Resuelto
odooV12
Avatar
Avatar
Avatar
Avatar
Avatar
4
may 24
8276
Redirect /jobs page not working
redirect
Avatar
Avatar
1
abr 24
2832
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.

Sitio web hecho con

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