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

Overwrite create function of calendar.event

Suscribirse

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

Se marcó esta pregunta
calendarcreateoverwritecalendar.eventgoogle_calendar
6315 Vistas
Avatar
Koffi KPONOUGLO

I have tree models and i want to overwrite create function of calendar.event models to get in the patners_ids field, who is patient and append it on the medical.appointment model on create. 

Here a part of code : 

Class MedicalAppointment(models.Model):

_name = "medical.appointment"

patient = fields.Many2one ('medical.patient', 'Patient', readonly=True, states={'draft': [('readonly', False)]}, help="Patient Name", required=True,)

class MedicalPatient(models.Model):

_name = "medical.patient"

name = fields.Many2one('res.partner', 'Patient', required="1", track_visibility='onchange', domain=[('is_patient', '=', True), ('is_person', '=', True)], help="Patient Name")

@api.multi

@api.depends('name', 'patient_id')

def name_get(self):

result = []

for partner in self:

name = partner.name.name

if partner.patient_id:

name = '[' + partner.patient_id + ']' + name

result.append((partner.id, name))

return result

@api.model

def name_search(self, name, args=None, operator='ilike', limit=100):

args = args or []

recs = self.browse()

# if name:

# recs = self.search(['|', '|', '|', '|', '|', ('name', operator , name), ('patient_id', operator , name), ('mobile', operator , name), ('other_mobile', operator , name), ('lastname', operator , name), ('middle_name', operator , name) ] )

if not recs:

recs = self.search([('name', operator, name)])

return recs.name_get()

class Meeting(models.Model):

_name = 'calendar.event'

partner_ids = fields.Many2many('res.partner', 'calendar_event_res_partner_rel', string='Attendees', states={'done': [('readonly', True)]}, default=_default_partners)

I write this code but it is not working well : 

class Meeting(models.Model):

_name = 'calendar.event'

_inherit = ["calendar.event"]

@api.model

def create(self, values):

if not 'user_id' in values: # Else bug with quick_create when we are filter on an other user

values['user_id'] = self.env.user.id

# compute duration, if not given

if not 'duration' in values:

values['duration'] = self._get_duration(values['start'], values['stop'])

meeting = super(Meeting, self).create(values)

final_date = meeting._get_recurrency_end_date()

# `dont_notify=True` in context to prevent multiple notify_next_alarm

meeting.with_context(dont_notify=True).write({'final_date': final_date})

meeting.with_context(dont_notify=True).create_attendees()

# Notify attendees if there is an alarm on the created event, as it might have changed their

# next event notification

if not self._context.get('dont_notify'):

if len(meeting.alarm_ids) > 0:

self.env['calendar.alarm_manager'].notify_next_alarm(meeting.partner_ids.ids)

if meeting.partner_ids:

patients = meeting.partner_ids.search([('is_patient', '=', True)])

patient = patients[0]

pat_name = patient.name

patient_obj = self.env['medical.patient']

current_patient = patient_obj.search(pat_name)

if meeting.start:

self.env['medical.appointment'].create({'patient': current_patient})

return meeting


I need a help 







0
Avatar
Descartar
Sehrish

Whats the error log?

¿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
Google Calendar sync creates contacts from past events – how to limit?
calendar google_calendar
Avatar
Avatar
1
jul 25
1653
Google Calendar sync creates contacts from past events – how to limit?
calendar google_calendar
Avatar
0
jul 25
1364
How to pass query parameters in URL to the Odoo calendar module?
calendar calendar.event
Avatar
0
jun 25
1553
How to create a Google event in an Organization shared calendar (not individual) when creating an appointment in Odoo?
calendar google_calendar
Avatar
Avatar
1
ene 25
2435
Sync specific caoendar with Google calendar
calendar google_calendar
Avatar
Avatar
2
nov 23
2741
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