Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bluemind4-connector
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Le Filament
bluemind4-connector
Compare revisions
702c5c2261fb0b0f6c5eda9357a4c87a40060182 to 02a17cc9dbfb77178b6d3fcec608f2c210a8af2d
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
lefilament/bluemind4-connector
Select target project
No results found
02a17cc9dbfb77178b6d3fcec608f2c210a8af2d
Select Git revision
Branches
14.0
1 result
Swap
Target
lefilament/bluemind4-connector
Select target project
lefilament/bluemind4-connector
1 result
702c5c2261fb0b0f6c5eda9357a4c87a40060182
Select Git revision
Branches
14.0
1 result
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
[FIX] typos and checks on lists
· 61bed106
Rémi - Le Filament
authored
3 years ago
61bed106
[FIX] rights and domains
· 02a17cc9
Rémi - Le Filament
authored
3 years ago
02a17cc9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
models/calendar_event.py
+6
-6
6 additions, 6 deletions
models/calendar_event.py
models/res_users.py
+41
-36
41 additions, 36 deletions
models/res_users.py
with
47 additions
and
42 deletions
models/calendar_event.py
View file @
02a17cc9
...
...
@@ -187,7 +187,7 @@ class CalendarEvent(models.Model):
bm_event
.
main
.
status
=
ICalendarElementStatus
(
"
Confirmed
"
)
bm_event
.
main
.
organizer
=
ICalendarElementOrganizer
()
bm_event
.
main
.
organizer
.
commonName
=
event
.
user_id
.
partner_id
.
name
bm_event
.
main
.
organizer
.
mailto
=
event
.
user_id
.
partner_id
.
mail
bm_event
.
main
.
organizer
.
mailto
=
event
.
user_id
.
partner_id
.
e
mail
if
event
.
user_id
.
bluemind_user_id
:
bm_event
.
main
.
organizer
.
dir
=
(
"
bm://
"
...
...
@@ -240,7 +240,7 @@ class CalendarEvent(models.Model):
bm_event
.
main
.
alarm
=
[]
for
alarm
in
self
.
alarm_ids
:
al
=
ICalendarElementVAlarm
()
if
alarm
.
alarm_type
=
"
notification
"
:
if
alarm
.
alarm_type
=
=
"
notification
"
:
al
.
action
=
ICalendarElementVAlarmAction
(
"
Display
"
)
else
:
al
.
action
=
ICalendarElementVAlarmAction
(
"
Email
"
)
...
...
@@ -275,7 +275,7 @@ class CalendarEvent(models.Model):
if
event
.
recurrency
:
bm_event
.
main
.
rrule
=
ICalendarElementRRule
()
bm_event
.
main
.
rrule
.
frequency
=
ICalendarElementRRuleFrequency
(
event
.
frequency
.
to
upper
()
event
.
rrule_type
.
upper
()
)
bm_event
.
main
.
rrule
.
interval
=
event
.
interval
if
event
.
end_type
==
"
count
"
:
...
...
@@ -287,12 +287,12 @@ class CalendarEvent(models.Model):
bm_event
.
main
.
rrule
.
until
.
timezone
=
event
.
event_tz
if
(
event
.
frequency
==
"
monthly
"
and
event
.
month_by
==
"
day
"
)
or
event
.
frequency
==
"
weekly
"
:
event
.
rrule_type
==
"
monthly
"
and
event
.
month_by
==
"
day
"
)
or
event
.
rrule_type
==
"
weekly
"
:
bm_event
.
main
.
rrule
.
byDay
=
[
ICalendarElementRRuleWeekDay
()]
bm_event
.
main
.
rrule
.
byDay
[
0
].
day
=
str
(
event
.
weekday
)
bm_event
.
main
.
rrule
.
byDay
[
0
].
offset
=
int
(
event
.
byday
)
elif
event
.
frequency
==
"
monthly
"
and
event
.
month_by
==
"
date
"
:
elif
event
.
rrule_type
==
"
monthly
"
and
event
.
month_by
==
"
date
"
:
bm_event
.
main
.
rrule
.
byMonthDay
=
[
event
.
day
]
return
bm_event
...
...
This diff is collapsed.
Click to expand it.
models/res_users.py
View file @
02a17cc9
...
...
@@ -157,6 +157,7 @@ class ResUser(models.Model):
# Calendar entries created on Bluemind side, not already in Odoo
# The events already in Odoo are ignored (probably already synced previously
if
bm_created_uids
:
events_to_create
=
[]
bm_events_to_create_uids
=
[
e
for
e
in
bm_created_uids
if
e
not
in
odoo_events_bm_uids
...
...
@@ -168,8 +169,9 @@ class ResUser(models.Model):
# Only if Organizer is the same as Odoo user or if is not linked to
# any active Odoo internal user
if
(
bm_event
.
value
.
main
.
organizer
.
mailto
==
self
.
partner_id
.
email
or
bm_event
.
value
.
main
.
organizer
.
mailto
not
in
odoo_users_emails
bm_event
.
value
.
main
.
organizer
and
(
bm_event
.
value
.
main
.
organizer
.
mailto
==
self
.
partner_id
.
email
or
bm_event
.
value
.
main
.
organizer
.
mailto
not
in
odoo_users_emails
)
):
events_to_create
.
append
(
Calendar
.
_bm_to_odoo_values
(
bm_event
))
if
events_to_create
:
...
...
@@ -177,10 +179,11 @@ class ResUser(models.Model):
# Calendar entries that have been updated on Bluemind
# Retrieve full events from Bluemind
if
bm_updated_uids
:
bm_events_to_update
=
bm_calendar
.
multipleGet
(
bm_updated_uids
)
# Update corresponding events
for
bm_event
in
bm_events_to_update
:
odoo_event
=
odoo_events_bm_linked
.
filtered
(
odoo_event
=
odoo_events_bm_linked
.
filtered
_domain
(
[(
"
bluemind_id
"
,
"
=
"
,
bm_event
.
uid
)]
)
# If related event exists in Odoo and belongs to the user, update it
...
...
@@ -195,9 +198,11 @@ class ResUser(models.Model):
# Calendar entries that have been deleted on Bluemind to be deleted on Odoo
# (only if belongs to user)
odoo_events_to_delete
=
odoo_events_bm_linked
.
filtered
(
if
bm_deleted_uids
:
odoo_events_to_delete
=
odoo_events_bm_linked
.
filtered_domain
(
[(
"
bluemind_id
"
,
"
in
"
,
bm_deleted_uids
),
(
"
user_id
"
,
"
=
"
,
self
.
id
)]
)
if
odoo_events_to_delete
:
odoo_events_to_delete
.
unlink
(
from_bluemind
=
True
)
# Update user last_sync_version with the latest one retrieved from Bluemind
...
...
@@ -224,7 +229,7 @@ class ResUser(models.Model):
for
user
in
users
:
_logger
.
info
(
"
Calendar Synchro - Starting synchronization for %s
"
,
user
)
try
:
user
.
with_user
(
user
).
sudo
().
sync_bluemind_calendar
()
user
.
with_user
(
user
).
sync_bluemind_calendar
()
_logger
.
info
(
"
Calendar Synchro - Completed synchronization for %s
"
,
user
)
...
...
This diff is collapsed.
Click to expand it.