Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Overwrite create function of calendar.event

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
calendarcreateoverwritecalendar.eventgoogle_calendar
6297 Widoki
Awatar
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
Awatar
Odrzuć
Sehrish

Whats the error log?

Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
Google Calendar sync creates contacts from past events – how to limit?
calendar google_calendar
Awatar
Awatar
1
lip 25
1637
Google Calendar sync creates contacts from past events – how to limit?
calendar google_calendar
Awatar
0
lip 25
1348
How to pass query parameters in URL to the Odoo calendar module?
calendar calendar.event
Awatar
0
cze 25
1539
How to create a Google event in an Organization shared calendar (not individual) when creating an appointment in Odoo?
calendar google_calendar
Awatar
Awatar
1
sty 25
2413
Sync specific caoendar with Google calendar
calendar google_calendar
Awatar
Awatar
2
lis 23
2741
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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