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
    • e-learning
    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
    • Conocimientos
    • 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
    Alimentación y hostelería
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Cervecería
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y soporte técnico
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Explorar todos los sectores
  • 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
    • Servicios para 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

How to show the cancel/save buttons on a popup form

Suscribirse

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

Se marcó esta pregunta
10 Respuestas
41883 Vistas
Avatar
Anuradha

How to show the cancel/save buttons on a popup form?

0
Avatar
Descartar
Avatar
Jérôme Thériault
Mejor respuesta

A bit of warning here. A button in a form WILL call python write() on the model, unless there are no writable fields in the view. So having the button specifically call write will have it call the write() method twice. Any button that is not special="cancel" will call the write() method, and this is by design.

Since the button will already call write, the button should define another method it will call afterwards but ONLY if the write() method returns True (on success). So add something like this on the view XML:

<footer>
<button name="write_success" type="object" string="Save"/> or <button string="Cancel" special="cancel"/>
</footer>

and define your method like this in the model:

@api.multi
def write_success(self):
    #do stuff, like return an action
#executed only if write() returned True (successful save)


0
Avatar
Descartar
Avatar
laribi
Mejor respuesta

Add this te the xml form :

<footer> <button name="write" type="object" string="Save"/> or <button name="cancel" string="Cancel" special="cancel" class="oe_link"/> </footer>
8
Avatar
Descartar
Atchuthan - Technical Consultant, Sodexis Inc

is the "write" function available in all py files???

laribi

Yes and you can redefine it by ( def write ....)

Avatar
Pawan
Mejor respuesta

I am new to Openerp and also faced the same problem you are facing.

I did some Research on this and came up with the solution in view.js file under web module:

at line  384, after "

 action.flags = _.defaults(action.flags || {}, {

            views_switcher : !popup && !inline,
            search_view : !popup && !inline,
            action_buttons : !popup && !inline,
            sidebar : !popup && !inline,
            pager : (!popup || !form) && !inline,
            display_title : !popup,
            search_disable_custom_filters: action.context && action.context.search_disable_custom_filters
        });"

ADD this line: 

"if (popup){
            action.flags.action_buttons = true;
        }"

This will show "save" and "Discard" buttons on 'target:new'.

Hope this will help you.

0
Avatar
Descartar
Avatar
Jamshid Chungath
Mejor respuesta

after target:'new'

add these

'flags': {'form': {'action_buttons': True}}

0
Avatar
Descartar
Badache Zoubir

and tree view?

Avatar
Fernando Gomes
Mejor respuesta

Hello All,

When I add the 'flags': {'form': {'action_buttons': True}} to the return values I do get the Save and Cancel buttons but the Cancel button does nothing and the Save button saves but does not close the popup window.Is there anyway to add some more values / attributes to the return list so that the popup would act just like the "Create and Edit..." of a M2M field?

Thanks,

Fernando

0
Avatar
Descartar
Avatar
Marcin Pieczyński
Mejor respuesta

Hi everyone

I git similar problem but a little much complicated:

I have three buttons in my popup:

    <button name="subscribe" type="object"
    string="Subscribe" class="oe_highlight"/>
    or
    <button name="subscribe_and_get_labels" type="object"
    string="Subscribe and get labels" class="oe_highlight"/>
    or
    <button special="cancel" string="Cancel"/>


"Subscribe"  - just save the data according to form, and close the window

"Subscribe and get labels" - save the data (as subscribe), return pdf report, and do not close window ! (That is the problem.)

"Close" - close the window.


"Subscribe and get labels" button return pdf by returning:

    {'type': 'ir.actions.act_url',
    'url': '/web/binary/saveas?model=ir.attachment&field=datas&filename_field=name&id=' + str(file.id),
    'target': 'new',
    }

but I would like it additionally to close the popup window.



0
Avatar
Descartar
Avatar
Francesco OpenCode
Mejor respuesta

When you open a record in modify state, all the popup has got cancel/save button

-1
Avatar
Descartar
Anuradha
Autor

i am passing form from py file. i want to see save button in pop up buts its not showing my code is return { 'type': 'ir.actions.act_window', 'name': 'Form heading', 'view_mode': 'form', 'view_type': 'form', # 'view_id': view_id, 'res_model': 'calldata1', 'nodestroy': True, #'res_id': this.id, # assuming the many2one

'target':'new',

          'context': context,
}
¿Le interesa esta conversación? ¡Participe en ella!

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

Inscribirse
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 empresariales de código abierto que cubre 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