Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
B
bluemind4-connector
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse du dépôt
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Le Filament
bluemind4-connector
Validations
702c5c22
Valider
702c5c22
rédigé
27 avr. 2022
par
Rémi - Le Filament
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
[ADD] alarm handling Bluemind --> Odoo
parent
bea4fb45
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
models/calendar_event.py
+20
-5
20 ajouts, 5 suppressions
models/calendar_event.py
avec
20 ajouts
et
5 suppressions
models/calendar_event.py
+
20
−
5
Voir le fichier @
702c5c22
...
...
@@ -35,6 +35,8 @@ from netbluemind.icalendar.api.ICalendarElementRRuleWeekDay import (
ICalendarElementRRuleWeekDay
,
)
from
netbluemind.icalendar.api.ICalendarElementStatus
import
ICalendarElementStatus
from
netbluemind.icalendar.api.ICalendarElementVAlarm
import
ICalendarElementVAlarm
from
netbluemind.icalendar.api.ICalendarElementVAlarmAction
import
ICalendarElementVAlarmAction
from
netbluemind.python.client
import
ServerFault
from
pytz
import
timezone
...
...
@@ -69,7 +71,7 @@ PARTSTATUS_CONVERTER_O2B = {
}
# TODO: manage
alarm_ids,
categories, attachments ?
# TODO: manage categories, attachments ?
# TODO: check if recurrency properly working without exceptions
# TODO: manage exceptions in recurrencies
class
CalendarEvent
(
models
.
Model
):
...
...
@@ -158,7 +160,8 @@ class CalendarEvent(models.Model):
}
)
# TODO: Add attendees handling
# TODO: Add attendees handling - how to manage already existing ids ?
# TODO: Add alarms handling - how to manage already existing ids ?
# Returns data dictionary
return
data
...
...
@@ -200,6 +203,7 @@ class CalendarEvent(models.Model):
# These fields are required (although not marked as such in doc / code)
# Otherwise you get a NullPointerException
# Manage attendees
bm_event
.
main
.
attendees
=
[]
for
attendee
in
self
.
attendee_ids
:
att
=
ICalendarElementAttendee
()
...
...
@@ -232,6 +236,16 @@ class CalendarEvent(models.Model):
att
.
internal
=
False
att
.
mailto
=
attendee
.
partner_id
.
email
or
""
bm_event
.
main
.
attendees
.
append
(
att
)
# Manage alarms
bm_event
.
main
.
alarm
=
[]
for
alarm
in
self
.
alarm_ids
:
al
=
ICalendarElementVAlarm
()
if
alarm
.
alarm_type
=
"
notification
"
:
al
.
action
=
ICalendarElementVAlarmAction
(
"
Display
"
)
else
:
al
.
action
=
ICalendarElementVAlarmAction
(
"
Email
"
)
al
.
trigger
=
alarm
.
duration_minutes
*
-
60
bm_event
.
main
.
alarm
.
append
(
al
)
# The following fields are not computed (yet ?)
bm_event
.
main
.
categories
=
[]
bm_event
.
main
.
attachments
=
[]
...
...
@@ -359,7 +373,7 @@ class CalendarEvent(models.Model):
# AFAICT Bluemind needs all the fields to be provided,
# you cannot send only the updated ones
if
result
and
not
from_bluemind
:
if
result
and
not
from_bluemind
and
self
.
user_id
.
is_bm_connection_ok
:
# Create a list of Bluemind events to be updated
bm_events
=
VEventChanges
()
bm_events
.
modify
=
[]
...
...
@@ -400,6 +414,7 @@ class CalendarEvent(models.Model):
"""
# Calls base create() function first
odoo_events
=
super
().
create
(
vals_list
)
if
self
.
user_id
.
is_bm_connection_ok
:
self
.
create_odoo_events_in_bm
()
return
odoo_events
...
...
@@ -410,7 +425,7 @@ class CalendarEvent(models.Model):
A parameter is added
"
from_bluemind
"
to avoid deleting a Bluemind event
when deletion is already coming from Bluemind
"""
if
not
from_bluemind
:
if
not
from_bluemind
and
self
.
user_id
.
is_bm_connection_ok
:
for
event
in
self
:
# If Odoo event is linked to a Bluemind event
if
event
.
bluemind_id
:
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter