Pular para o conteúdo
Odoo Menu
  • Entrar
  • Experimente grátis
  • Aplicativos
    Finanças
    • Financeiro
    • Faturamento
    • Despesas
    • Planilhas (BI)
    • Documentos
    • Assinar Documentos
    Vendas
    • CRM
    • Vendas
    • PDV Loja
    • PDV Restaurantes
    • Assinaturas
    • Locação
    Websites
    • Criador de Sites
    • e-Commerce
    • Blog
    • Fórum
    • Chat ao Vivo
    • e-Learning
    Cadeia de mantimentos
    • Inventário
    • Fabricação
    • PLM - Ciclo de Vida do Produto
    • Compras
    • Manutenção
    • Qualidade
    Recursos Humanos
    • Funcionários
    • Recrutamento
    • Folgas
    • Avaliações
    • Indicações
    • Frota
    Marketing
    • Redes Sociais
    • Marketing por E-mail
    • Marketing por SMS
    • Eventos
    • Automação de Marketing
    • Pesquisas
    Serviços
    • Projeto
    • Planilhas de Horas
    • Serviço de Campo
    • Central de Ajuda
    • Planejamento
    • Compromissos
    Produtividade
    • Mensagens
    • Aprovações
    • Internet das Coisas
    • VoIP
    • Conhecimento
    • WhatsApp
    Aplicativos de terceiros Odoo Studio Plataforma Odoo Cloud
  • Setores
    Varejo
    • Loja de livros
    • Loja de roupas
    • Loja de móveis
    • Mercearia
    • Loja de ferramentas
    • Loja de brinquedos
    Comida e hospitalidade
    • Bar e Pub
    • Restaurante
    • Fast Food
    • Hospedagem
    • Distribuidor de bebidas
    • Hotel
    Imóveis
    • Imobiliária
    • Escritório de arquitetura
    • Construção
    • Administração de propriedades
    • Jardinagem
    • Associação de proprietários de imóveis
    Consultoria
    • Escritório de Contabilidade
    • Parceiro Odoo
    • Agência de marketing
    • Escritório de advocacia
    • Aquisição de talentos
    • Auditoria e Certificação
    Fabricação
    • Têxtil
    • Metal
    • Móveis
    • Alimentação
    • Cervejaria
    • Presentes corporativos
    Saúde e Boa forma
    • Clube esportivo
    • Loja de óculos
    • Academia
    • Profissionais de bem-estar
    • Farmácia
    • Salão de cabeleireiro
    Comércio
    • Handyman
    • Hardware e Suporte de TI
    • Sistemas de energia solar
    • Sapataria
    • Serviços de limpeza
    • Serviços de climatização
    Outros
    • Organização sem fins lucrativos
    • Agência Ambiental
    • Aluguel de outdoors
    • Fotografia
    • Aluguel de bicicletas
    • Revendedor de software
    Navegar por todos os setores
  • Comunidade
    Aprenda
    • Tutoriais
    • Documentação
    • Certificações
    • Treinamento
    • Blog
    • Podcast
    Empodere a Educação
    • Programa de educação
    • Scale Up! Jogo de Negócios
    • Visite a Odoo
    Obtenha o Software
    • Baixar
    • Comparar edições
    • Releases
    Colaborar
    • Github
    • Fórum
    • Eventos
    • Traduções
    • Torne-se um parceiro
    • Serviços para parceiros
    • Cadastre seu escritório contábil
    Obtenha os serviços
    • Encontre um parceiro
    • Encontre um Contador
    • Conheça um consultor
    • Serviços de Implementação
    • Referências de Clientes
    • Suporte
    • Upgrades
    Github YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Faça uma demonstração
  • Preços
  • Ajuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Financeiro
  • Inventário
  • PoS
  • Projeto
  • MRP
All apps
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
Ajuda

Overwrite create function of calendar.event

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
calendarcreateoverwritecalendar.eventgoogle_calendar
6328 Visualizações
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
Cancelar
Sehrish

Whats the error log?

Está gostando da discussão? Não fique apenas lendo, participe!

Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!

Inscreva-se
Publicações relacionadas Respostas Visualizações Atividade
Google Calendar sync creates contacts from past events – how to limit?
calendar google_calendar
Avatar
Avatar
1
jul. 25
1664
Google Calendar sync creates contacts from past events – how to limit?
calendar google_calendar
Avatar
0
jul. 25
1373
How to pass query parameters in URL to the Odoo calendar module?
calendar calendar.event
Avatar
0
jun. 25
1560
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
jan. 25
2452
Sync specific caoendar with Google calendar
calendar google_calendar
Avatar
Avatar
2
nov. 23
2742
Comunidade
  • Tutoriais
  • Documentação
  • Fórum
Open Source
  • Baixar
  • Github
  • Runbot
  • Traduções
Serviços
  • Odoo.sh Hosting
  • Suporte
  • Upgrade
  • Desenvolvimentos personalizados
  • Educação
  • Encontre um Contador
  • Encontre um parceiro
  • Torne-se um parceiro
Sobre nós
  • Nossa empresa
  • Ativos da marca
  • Contato
  • Empregos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidade
  • Segurança
الْعَرَبيّة 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 é um conjunto de aplicativos de negócios em código aberto que cobre todas as necessidades de sua empresa: CRM, comércio eletrônico, contabilidade, estoque, ponto de venda, gerenciamento de projetos, etc.

A proposta de valor exclusiva Odoo é ser, ao mesmo tempo, muito fácil de usar e totalmente integrado.

Site feito com

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