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
    • 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 taberna
    • 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
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • 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
    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

[v12] Log Internal Note with action button and wizard

Suscribirse

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

Se marcó esta pregunta
wizardloginheritchatternote
5 Respuestas
12361 Vistas
Avatar
Cayprol

Hi, I am trying to add a feature to require "Log Note", the internal note logged in the chatter, upon canceling 'stock.picking' record.  
My code to override the original "action_cancel"  
  

def action_cancel(self):
view = self.env.ref('mail.email_compose_message_wizard_form')
wiz = self.env['mail.compose.message'].create({'is_log': True})
_logger.info("Action Cancel is overrided.")
super(Picking, self).action_cancel()
return {
'name': _('Your Reason to Cancel?'),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'mail.compose.message',
'views': [(view.id, 'form')],
'view_id': view.id,
'target': 'new',
'res_id': wiz.id,
'context': {},
}
  

It opens up the write wizard, but when I hit button 'Log', wizard closes but no note is logged in chatter.
Should I pass anything else through context?  

I already tried    


'context': {'active_model': self._name,
'active_id':self.id}

And also this in context.
    'context': {'default_model': self._name,
'default_res_id':self.id}
0
Avatar
Descartar
Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Mejor respuesta

Pass message_type field and it's value ("comment" or "notification") in the context when you return an action.

'default_message_type': 'comment',


3
Avatar
Descartar
Cayprol
Autor

thx for reply, I just tried but still not working.

I also looked into mail_compose_message.py,

line 125: message_type = fields.Selection(default="comment")

I think without default_, on creation, message_type has already been comment.

Sudhir Arya (ERP Harbor Consulting Services)

Try with notification as well in place of comment.

Cayprol
Autor

It seems like if I pass default_message_type in context regardless the value, the wizard cannot be opened, and caused odoo-server error:

The requested operation cannot be completed due to security restrictions. Please contact your system administrator.

(Document type: Email composition wizard, Operation: create)

is_log = fields.Boolean('Log an Internal Note', help='Whether the message is an internal note (comment mode only)')

Field is_log says it only works in comment mode, I am so lost.

Avatar
Cayprol
Autor Mejor respuesta

I finally got it figured out.  For future reference,  

To Log note in the chatter.  There is a built-in function available named "message_post".  

There's no need to directly call the built-in wizard, I can create my own wizard and just write an action to use "message_post".  

"message_post" is available by _inherit = ['mail.thread', 'mail.activity.mixin'], which is needed for the xml form view to display chatter section anyway.  

Example:  

# This method overrides action_cancel and calls my own wizard.
def action_cancel(self):
view = self.env.ref('mymodule.xmlid_of_wizard')
wiz = self.env['action.cancel.confirm'].create({})
_logger.info("Action Cancel is overrided.")
super(Picking, self).action_cancel()
return {
'name': _('Your Reason to Cancel?'),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'action.cancel.confirm',
'views': [(view.id, 'form')],
'view_id': view.id,
'target': 'new',
'res_id': wiz.id,
'context': {'parent_model': self._name,
'parent_id': self.id},
}


# Method in the wizard to Log
def action_confirm(self):
parent = self.env[self._context['parent_model']].browse(self._context['parent_id'])
msg = "Log to write"
parent.message_post(body=msg)
1
Avatar
Descartar
¿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
In odoo17.How to synchronize the information to the fields of the new model when chatter log adds new data?
log chatter
Avatar
0
abr 24
2233
I want person should receive log data every day on his email ,for any record like project task, log notes every day,How its possible?
log chatter
Avatar
0
dic 19
3007
How to add a field to a wizard? Resuelto
wizard inherit edit
Avatar
Avatar
1
mar 15
11368
My old Log Notes are disappearing on SO and PO as the log gets longer
log purchase_order sales.order note
Avatar
0
abr 24
1531
14E - Track activities changes on chatter
log chatter activities v14
Avatar
Avatar
Avatar
2
mar 24
3216
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