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

Unable to validate a warning message in sale order form

Suscribirse

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

Se marcó esta pregunta
salewarning
1 Responder
7806 Vistas
Avatar
Vikram

My requirement is OpenERP should throws a warning message when i click a Cancel button in Sale order. In warning wizard, If i press OK then state of Sale order should be changed to cancel or if i press button cancel the wizard should close and state wont change.

Wizard is shown, but my problem is when i click any button (OK or Cancel or Close (X)), the state of Sale order is changed. I need to control this for only pressing OK button. If i click other button it should close a warning or wizard box.

 

Installed : warning_box module(Author: Jme Steve)

Inherit a sale module and button here. As per details given in waning_box module, i created a line in end of cancel button for picking a 

i customized a warning message 

Sale Order file.

 def cancel_ordersss(self,cr,uid,ids,context=None):
        self.write(cr, uid, ids, {'state':'cancel'})
        return self.pool.get('warning_box').warning(cr, uid, title='Cancel Order', message='Are you sure to cancel this order')
        

Wizard file

<openerp> 
    <data> 
        <record id="warning_box_form" model="ir.ui.view">
             <field name="name">warning_box.form</field> 
             <field name="model">warning_box</field> 
             <field eval="20" name="priority"/> 
             <field name="arch" type="xml"> 
                 <form string="Warning" version="7.0"> 
                     <field name="message" nolabel="1"/> 
                     <footer> 
                        <button string="OK" name="message" type="object" class="oe_highlight" special="cancel"/> 
                        or
                        <button class="oe_link" name="return_false" type="object" string="Cancel"/> 
                        
                     </footer> 
                 </form> 
            </field>
        </record>
    
        <record model="ir.actions.act_window" id="action_warning_box">
            <field name="name">Warning Box</field>
            <field name="res_model">warning_box</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="view_id" ref="warning_box_form" />
            <field name="target">new</field>
        </record>
    </data>
 
</openerp>

 

Kindly provide a solution to solve this problem. 

 

--------------------------------------------------------------------------------------------------------------

I created my own module to do that. For that also having errors. kindly suggest a solution.

Wizard view file

<record id="view_cancel_order_wizard" model="ir.ui.view">
            <field name="name">Cancel Repair</field>
            <field name="model">sale.order.confirm</field>
            <field name="arch" type="xml">
                <form string="Confirm Sale Order" version="7.0">
                    <group>
                        <label string="This Sale Order will be confirmed with service Product. Agree?"/>
                    </group>
                    <footer>
                        <button name="action_cancel" string="Yes" type="object" class="oe_highlight"/>
                        or
                        <button string="Cancel" class="oe_link" special="cancel" />
                    </footer>
                </form>
            </field>
        </record>

Wizard Python file

import time
from lxml import etree

from osv import fields, osv
from tools.translate import _
import pooler
    
class sale_order_confirm(osv.osv):
    _name = "sale.order.confirm"
    _description = "Sales Order Confirm"

def action_cancel(self, cr, uid, ids, context=None):
        assert len(ids) == 1, 'This option should only be used for a single id at a time.'
        #~ wf_service = netsvc.LocalService('workflow')
        #~ wf_service.trg_validate(uid, 'sale.order', ids[0], 'order_confirm', cr)
        self.write(cr, uid, ids, {'state':'cancel'})
        # redisplay the record as a sales order
        view_ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'sale.order.confirm', 'view_cancel_order_wizard')
        view_id = view_ref and view_ref[1] or False,
        return {
            'type': 'ir.actions.act_window',
            'name': _('Sales Order'),
            'res_model': 'sale.order',
            'res_id': ids[0],
            'view_type': 'form',
            'view_mode': 'form',
            'view_id': view_id,
            'target': 'current',
            'nodestroy': True,
        }
        return True
        

sale_order_confirm()

Getting error invalid xml when i start update this module. Kindly suggest a solution.

0
Avatar
Descartar
Avatar
Rajkumar
Mejor respuesta

Hi,

Try below code in your customized module

In view.xml

<button name="action_cancel_yes" string="YES" type="object" class="oe_highlight"/>

<button name="action_cancel_no" string="NO" type="object" class="oe_highlight"/>

In python

def action_cancel_yes(self, cr, uid, ids, context=None):

       return True

def action_cancel_no(self, cr, uid, ids, context=None):

      raise osv.except_osv(_('Alert !!'), _('Your sale order is  NOT Cancel'))

 

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
Issue After Migration: Unable to Save Sales Order in v18 Resuelto
sale
Avatar
Avatar
1
may 25
1912
How to set serial numbers for the sale order line
sale
Avatar
Avatar
Avatar
2
feb 25
10852
How to Save Record After Showing Warning Message in Odoo 12
warning
Avatar
Avatar
Avatar
2
dic 19
10153
model cache has been invalidated
warning
Avatar
0
nov 19
5259
Error on Warning in Odoo 12 Resuelto
warning
Avatar
Avatar
1
jul 19
7872
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