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

Don't send automatic e-mail when confirming quotation?

Suscribirse

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

Se marcó esta pregunta
mailportalmail_threadodoo8.0
3 Respuestas
9207 Vistas
Avatar
Yenthe Van Ginneken (Mainframe Monkey)

Hi guys,

When you have portal activated you'll get an automatic e-mail saying something along these lines:

 Quotation confirmed
    • Customer: Yenthe
    • Untaxed Amount: 1.

The problem is that I do not want this message to be e-mailed. Any message should be e-mailed to the customer when the portal is active, except this one.
The message is made by the function format_message in mail/mail_thread.py:

 def format_message(message_description, tracked_values):
            message = ''
            if message_description:
                message = '<span>%s</span>' % message_description
            for name, change in tracked_values.items():
                message += '<div> &nbsp; &nbsp; &bull; <b>%s</b>: ' % change.get('col_info')
                if change.get('old_value'):
                    message += '%s &rarr; ' % change.get('old_value')
                message += '%s</div>' % change.get('new_value')
            return message
        if not tracked_fields:
            return True

This function posts the message to the view (in the chatter) but the problem is that somewhere else an action is triggered to send this message as an e-mail to the user.

So, my question, how can I / what is the best way to prevent this message to be send by email but allow anything else to be e-mailed to the customers?

Thanks,
Yenthe

1
Avatar
Descartar
Avatar
Yenthe Van Ginneken (Mainframe Monkey)
Autor Mejor respuesta

Hi guys,

Found the solution myself. In the module mail is a Python file named mail_thread. In mail_thread.py is a function def message_track(self, cr, uid, ids, tracked_fields, initial_values, context=None): and inside this function you will find the following code:

 for subtype in subtypes:
                subtype_rec = self.pool.get('ir.model.data').xmlid_to_object(cr, uid, subtype, context=context)
                if not (subtype_rec and subtype_rec.exists()):
                    _logger.debug('subtype %s not found' % subtype)
                    continue
                message = format_message(subtype_rec.description if subtype_rec.description else subtype_rec.name, tracked_values)
                self.message_post(cr, uid, browse_record.id, body=message, subtype=subtype, context=context)
                posted = True
            if not posted:
                message = format_message('', tracked_values)
                self.message_post(cr, uid, browse_record.id, body=message, context=context)

When you change the message variable in the first if condition there will be no more automatic messages e-mailed, not even when the portal is activated.Result:

 for subtype in subtypes:
                subtype_rec = self.pool.get('ir.model.data').xmlid_to_object(cr, uid, subtype, context=context)
                if not (subtype_rec and subtype_rec.exists()):
                    _logger.debug('subtype %s not found' % subtype)
                    continue
                message = format_message('', tracked_values)
                self.message_post(cr, uid, browse_record.id, body=message, context=context)
                posted = True
            if not posted:
                message = format_message('', tracked_values)
                self.message_post(cr, uid, browse_record.id, body=message, context=context)
0
Avatar
Descartar
Avatar
Axel Mendoza
Mejor respuesta

You could read more about that here:

https://www.odoo.com/es_ES/forum/help-1/question/adding-messages-subtypes-for-product-changes-v7-91170#answer-91171

In your case you could disable that tracking of the needed fields just defining the field name in the _track dict with a lambda function that returns False like:

_track = {
    'field': {
'sale.mt_quotation.anything': lambda self, cr, uid, obj, ctx=None: False,
}
}
0
Avatar
Descartar
Axel Mendoza

it will have the same results like you have with the change, the difference is that you need to define all the field tracked in your model in the _track dict

Ehtesham

I am facing the same issue, I want to mute only email for this subtype message "Quotation Confirmed". Trying your method now.

Ehtesham

Thanks, I just tried and it works as expected however I don't want to include all fields in my child model. I just want 'sale.mt_order_confirmed' to be set false. So in my child model instead of this _track = { 'state': { 'sale.mt_order_confirmed': lambda self, cr, uid, obj, ctx=None: False, 'sale.mt_order_sent': lambda self, cr, uid, obj, ctx=None: obj.state in ['sent'] }, } I want something like this _track['state']['sale.mt_order_confirmed'] = lambda self, cr, uid, obj, ctx=None: False Excuse my syntax I am new to Python, I just want to change the targeted field's specific state. just to be future proof.

Axel Mendoza

Then you are ready to vote the answer :). The other scenario that you describe require the extension of the message_track method in your model extension to support that behavior

Avatar
Roman Gsponer
Mejor respuesta

If anyone wants to prevent from sending quotations (no matter if it's a portal-user or not) you can use this:


class NoQuotationSaleOrder(models.Model):
_inherit = 'sale.order'

@api.multi
def action_quotation_send(self):
self.ensure_one()

if self.state != "sale":
return False

# Use this if you want to use the access token in your email-template:
self._portal_ensure_token()

return super(NoQuotationSaleOrder, self).action_quotation_send()


0
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
Odoo 8 mail problems: Admin receives all messages / notification of new mails not working
mail odoo8.0
Avatar
0
jul 16
3994
'NoneType' object has no attribute 'id' on incoming mail server action.
mail mail_thread incomingemail
Avatar
0
jun 21
4216
Correct way to use multiple outgoing mailservers for multiple users? Resuelto
mail mailserver odoo8.0
Avatar
Avatar
1
abr 21
12956
How to disable auto-add followers in discussion groups - copy solution from mail_thread.py?
follower mail odoo8.0
Avatar
Avatar
Avatar
2
mar 16
10372
odoo v8 mail_thread displaying received html email with table inside, table width wider than parent div width
mail v8 css mail_thread
Avatar
1
jul 16
4622
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