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
    • Información
    • 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

How to post a change log message for relational One2many fields?

Suscribirse

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

Se marcó esta pregunta
10.0
3 Respuestas
8767 Vistas
Avatar
Yousef Al-Hadhrami

Dear Community,

I have the o_chatter located on the main record view to post changes to fields

<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
<field name="message_ids" widget="mail_thread">
</div>

Right now when I change char fields such as name, it will post a message on the chatter saying that 

Name: Yousef  Al-Hadhrami Ali Al-Hadhrami                       

but when I change a relational field such as employee family which is a relational field, it will only post ids instead of contents


This is the One2many field

class HrEmployeeFamily(models.Model):
_inherit = 'hr.employee'
employee_family_ids = fields.One2many(
string="Family",
comodel_name='hr.employee.family',
inverse_name='related_employee'
)

and let's say this is the family model:

class EmployeeFamily(models.Model):
_name = 'hr.employee.family'
_inherit = 'employee.record'

related_employee = fields.Many2one('hr.employee', string="Related Employee")
family_name = fields.Char(track_visibility='onchange')

instead of writing on the chatter 

Family Name:Jack Sporrow  Jack Smith       

it writes the model and ids:

Family Name:hr.employee.family,8

I'd like it to post a full detailed log on what was changed on the relational field, how can I achieve that?

0
Avatar
Descartar
Ravi Gadhia

which version are you using?

Yousef Al-Hadhrami
Autor

Version 10

Yousef Al-Hadhrami
Autor

@Ravi, your answer kinda did something but not the thing that it should do

it only shows the record if it was updated

so lets say you had family_name + family_date_of_birth, and you modify one of those, it won't show up on the log because it only shows when a record gets linked to the employee himself.

Yousef Al-Hadhrami
Autor

it only shows the record when it gets linked or unliked from an employee

but if you change something in the record, it won't show on the log because the link haven't changed

Ravi Gadhia

I think you need a related field on the model because currently family_name, family_date_of_birth are not direct model field so it does not reflect it's changing on chatter

Yousef Al-Hadhrami
Autor

I think there is,

related_employee = fields.Many2one('hr.employee', string="Related Employee") is the related field on on Family

employee_family_ids = fields.One2many(

string="Family",

comodel_name='hr.employee.family',

inverse_name='related_employee'

) is the related field on the employee

Yousef Al-Hadhrami
Autor

I found a way to [ost to the parent record that one of the family records is updated, deleted or created

here is what I used (for update only):

@api.multi

def write(self, values):

"""Override default Odoo write function and extend."""

self.env['mail.message'].create({

'body': 'Personal Document ' + self.number + ' Updated',

'model': 'hr.employee',

'res_id': self.employee_ref.id,

'subtype_id': '2',

})

return super(HrEmployeePersonalDocument, self).write(values)

Ravi Gadhia

it seems the current implementation of chatter doesn't track change on one2many field and post-change entry on chatter.

you want to track the change of one2many field (employee_family_ids) on hr.employee

https://github.com/odoo/odoo/blob/10.0/addons/mail/models/mail_tracking_value.py#L35

I talked about related field mean getting a related field on 'hr.employee.family' like

employee_name = fields.Char(related="related_employee.name")

but it will not work because of you want post entry on hr.employee

your solution looks good on change/write of a relevant field of family mode post message on employee model

Avatar
Ravi Gadhia
Mejor respuesta

can you try after adding _rec_name in`hr.employee.family`

class EmployeeFamily(models.Model):   
     _name = 'hr.employee.family'   
     _inherit = 'employee.record'  
     _rec_name = 'family_name'​

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
Can't reconcile bank statement line
10.0
Avatar
Avatar
Avatar
Avatar
4
abr 20
10180
how to use field from same model Resuelto
10.0
Avatar
Avatar
1
nov 19
4768
How to fix: "odoo.addons.base.ir.ir_qweb.assetsbundle: This error occured while compiling the bundle 'web.assets_frontend' containing:"?
10.0
Avatar
Avatar
2
feb 18
15361
List view pass context for many2one fields
10.0
Avatar
0
ene 18
9531
App is not appearing in the list Resuelto
accounting 10.0
Avatar
Avatar
Avatar
3
jun 24
5081
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