Before this task, lots of mails were sent after updating or deleting recurrent event in 'All events' or 'This and future events' update type. This was happening because updating these recurrent events was triggering patch calls event by event, when they should be handled in batch.
After this commit, updating or deleting recurrent events should trigger at most two mails for Google users.
closesodoo/odoo#137607
Task-id: 3163695
X-original-commit: ad2106babda61446bce13283d570dc723418b630
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
Signed-off-by: Gabriel de Paula Felix (gdpf) <gdpf@odoo.com>
Add a helper method to know when the user calendar
is fully synced to Google Calendar, meaning when
API calls can correctly be performed.
The user calendar is considered fully synced if the
Google API is correctly configured in the settings
(Client ID / Secret) and the user has synced its
calendar with its Google Account.
Task-3285601
Part-of: odoo/odoo#133921
Add a 'google_meet' value for the event videocall location
to make the difference between a custom videocall link and
a google meet one.
Task-3285601
Part-of: odoo/odoo#133921
Purpose
=======
Add the possibility to only synchronize one specific event of
a user calendar instead of syncing the whole calendar.
Specification
=============
In certain cases, we do not want to synchronize the whole user
calendar with all the events and recurrences but only a specific
event. For example, in appointment, to retrieve the generated
google meet url of a specified event.
To perform the single event synchronization a synchronization
token is needed, meaning we cannot do a single event
synchronization prior to a full calendar synchronization as it
is the full sync which generates the temporary sync token.
To prevent the need of doing a full sync before a single event sync,
the permanent synchronization token is been used instead of
the temporary one when performing a single event synchronization.
Task-3285601
Part-of: odoo/odoo#133921
Before this commit, trying to delete a recurrent event that was already synced with Google Calendar or Microsoft Calendar was raising a traceback and not showing the User Error which forbids this action to be done.
After this commit, the traceback is not shown anymore and the User Error is correctly presented to the user while trying to delete a recurrent event (with Microsoft synchronization active).
Traceback snippet:
result = _call_kw_multi(method, model, args, kwargs)
File '/data/build/odoo/odoo/api.py', line 448, in _call_kw_multi
result = method(recs, *args, **kwargs)
File '/data/build/odoo/addons/microsoft_calendar/models/calendar.py', line 168, in action_mass_archive
if self._check_microsoft_sync_status() and any(self.microsoft_id):
TypeError: 'bool' object is not iterable
The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
closesodoo/odoo#134293
Issue: 3468190
Task-id: 3473180
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
Signed-off-by: Gabriel de Paula Felix (gdpf) <gdpf@odoo.com>
This commit addresses a synchronization issue with Google Calendar,
which arose after the implementation of commit https://github.com/odoo/odoo/pull/94018/commits/d9c4043557c6460b3860216bdfd39a623a5e0795.
The mentioned commit added tracking to the pre-commit process,
inadvertently causing problems during Google Calendar synchronization.
During the synchronization of Google Calendar, a recurring event that
had one of its occurrences deleted resulted in Google sending both a
recurring event record and a cancelled single event. In Odoo's
synchronization process, it first created occurrences for the recurrent
event and then synced the single events. During this synchronization of
single events, the existing cancelled events were unlinked using the
`_cancel` function to remove the event.
The issue surfaced when the `_message_track_post_template` function was
called in the pre-commit phase. If the appointment function was
installed, the `_track_template` was overridden in this module, leading
to an attempt to access the removed event, which raised an error and
prevented calendar synchronization.
With this modification, the `_track_template` will not be called for
the created event that was cancelled in the same transaction.
opw-3418758
closesodoo/odoo#132174
X-original-commit: c1a455f6a46a8c936176e306f35651d60e39f869
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
Before this commit, the permission defined in Google Calendar of editing events by guests was always set in Odoo Calendar as 'True', even though there was also the 'False' option. This way, creating an event that didn't accept being edited by guests in Google and then updating it in Odoo by a guest was creating duplicates in Odoo Calendar and wrong lists of attendees.
After this commit, the permission of guests modifying the event is taken into account in Odoo Calendar. If a guest updates an event that doesn't allow updates, a warning is shown forbidding the update and the reason explained.
closesodoo/odoo#127397
Task-id: 3276829
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
If no partner is found for a given email after calling '_mail_search_on_user'
and '_mail_find_partner_from_emails' the returned result is a void recordset
for the email.
When rebrowsing partners afterwards, browsing p.id for each partner leads
to potentially browsing False, which gives a different recordset from a
void recordset. This further causes a crash in '_write_from_google' as
he considers [False] as not being void.
This commit fixes that by correctly filtering out void partners. This is
globally a followup of odoo/odoo#99330.
Task-3453577 (TestMail: Update Alias/Gateway tests for MC)
Prepares Task-36879 (Mail: Support MultiCompany Aliases)
Part-of: odoo/odoo#130768
One of the main issue with ormcache is that the invalidation clears
everything, meaning that some value, slow to compute but with a long
lifetime, can be removed from the cache because an easy to invalidate
value is cleared, like after writting or creating a product has an
example.
Most example in the code will try to invalidate the cache of the models
doing something like `env['ir.qweb'].clear_caches()` but it is
finally equivalent to `env.registry.clear_cache()`, and cross worker.
The idea is to have multiple cache, maybe with specific sizes for a
specific purpose.
Having one per model is maybe a bad idea because it will be difficult
to size the LRU correcly, and it is too dynamic. Checking invalidation
may be expensive.
The proposed solution is closed allow a limited number of named caches,
using onse sequence per cache. This is actually close to the
cache_longterm.
We want to discourage using a specific cache for one use case in
the buisness code. Adding a cache shouldn't be something easy, doable
in stable.
Note that we could also change the invalisation mecanism using an
insert only table. We an check the sequence of this table, but also
fetch all invalidation messages.
Another possible improvement, especially if we have more than x cache is
to have a global sequence, checking signaling would mean to check the
main sequence, and only the other ones if the main one changed.
Note that this poc is inspired from the long term cache but not all
use case where applie yet.
Part-of: odoo/odoo#119813
- Improve performances, as the ir.rule restricting private partners
visibility is also applied on res.users by inheritance, on each
prefetch.
- Solve the issue of partners set as followers on records (eg: application
form) and then made private, making them impossible to contact via the
chatter.
- Solve the multiple access issues when trying to access the bank
account, or the private address for non HR people like the accountants
forcing the usage of sudo in the business code.
TaskID: 3101400
Steps to reproduce:
-------------------
We google calendar, create a recurring event with
three occurrences.
We obtain 3 events in chronological order:
- A
- B
- C
Change the title of the event B and apply the changes
to the following events.
We get:
- A: First title
- B: Second title
- C: Second title
Modify the schedule of event C and apply the changes
only to this event.
We get:
- A: First title + First schedule
- B: Second title + First schedule
- C: Second title + Second schedule
Synchronize Google calendar with Odoo.
Issue:
------
Event C is "duplicated".
Event C will exist with the first schedule
and the second schedule.
Cause:
------
A recurrent event with `google_id` is equal to
`ID_RANGE_TIMESTAMP` can be rescheduled.
If this is the case, its `google_id`
will be equal to `ID_TIMESTAMP`.
We do not manage the deletion of the event
that belongs to the old `google id`.
Solution:
---------
When we detect a recurring event with
a modified schedule, we have to delete the event
from the old `google_id`
(which is the event with the old schedule).
For this, it is necessary to find
the old `google_id` based on the elements contained
in the `id` and the `recurringEventId` of the event.
opw-3143680
closesodoo/odoo#121825
X-original-commit: 3f145af00307383e2d0a0891d05b8db59b13662a
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
Before this commit: it was possible to create an event for another user as
its organizer. But even if that user has a synchronized Google calendar, it
will be sent by the current user token, and it causes several issues.
The solution is to use the event's organizer token if it exists.
opw-3076595
closesodoo/odoo#120368
X-original-commit: 966943168dc9da0622485a46b0786ed5765eaf77
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
Steps to reproduce:
- Install 'CRM' module (for test purpose)
- Configure the google calendar credentials on Odoo
- Go to CRM -> Configuration -> Activity Types and create a new one
- Set 'Meeting' as Action
- As default note, add some bullet points:
```
Hello :
- First point
- Second point
- Third point
```
- Open any Opportunity and create a new Activity (in the chatter)
- Select 'Meeting' as activity type and open the calendar
- Add a new event (description should be field with the default note)
- Open the event (on Odoo and/or Google Calendar)
Issue:
The description of the event is broken (bullet points missing).
Cause:
When syncing the event from Odoo to Google Calendar, the description
is converted to plain text (using `html2plaintext` function).
Then, when syncing the event from Google Calendar to Odoo,
the description is also updated locally with the remote one.
Solution:
Don't convert the description to plain text but use
`tools.html_sanitize` on the html content instead to sanitize it.
opw-3105194
closesodoo/odoo#119695
X-original-commit: 21f3f9aa31a44840077b80d27aaee8160b391308
Signed-off-by: Nasreddin Boulif (bon) <bon@odoo.com>
In sentry we receive like 2k syncing issue from google_calendar.
This commit converts `_logger.error` to `_logger.warning` because we don't
need an erro for that
sentry-4121123364
https://online.sentry.io/issues/4121123364closesodoo/odoo#119742
X-original-commit: e797712561113f098edc1346995cecd7e96ad362
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: Achraf <abz@odoo.com>
When using message_post, the body format must be explicitly specified.
If html is expected, a Markup object should be used.
If text is given, the content will be escaped.
Before this PR:
message_post was unaware if the content of a message was HTML or
text. This lead to multiple situation where the content was
incorrectly considered as HTML and led to display errors.
In
self.message_post(body="Hello %s!" % self.name)
if the name contained HTML, it would be evaluated.
In
self.message_post(body="Contact Raoul <raoul@caramail.be>")
the email would not be displayed as considered as unknown HTML and
discarded by the sanitizer
Now each call must explict the type of content.
Use the escape() helper to properly combine Markup and translations.
It would also be acceptable to use Markup() to wrap a static
translation but escape is better as one can not guarantee the content
of a translation.
closesodoo/odoo#111850
Related: odoo/documentation#3612
Related: odoo/enterprise#36728
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Before this commit, when an event was synced with internal and external users,
the corresponding partners were merged like this:
1) partner corresponding to internal users
2) regular partner
If the list of emails provided by google was in another order: regular partners
then internal, there were an issue:
```
emails = [a.get('email') for a in google_attendees] # sorted by google, external then internal for example
partners = self._get_sync_partner(emails) # always internal then external partners
for attendee in zip(emails, partners, google_attendees):
# we are associating the external email with internal partner
# the external attendee is skipped because we take the user partner
```
This commit makes sure to return the partner is the order of the mails in _get_sync_partner.
closesodoo/odoo#118355
X-original-commit: ae442c20878277da93feb8761f5ed556c0c735b2
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Arnaud Joset <arj@odoo.com>
According to Wiktionary, French spacing is "the archaic practice (though
still current in French) of inserting a space around colons, semicolons,
question marks, and exclamation marks". This is not standard practice in
English and most languages of the world.
The purpose of this commit is to start purging the code from this typo,
as it may reflect poorly on the software for some people.
closesodoo/odoo#114533
Related: odoo/enterprise#37853
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Since we create a google meet link when we create an event, we get an
issue with the appoitments that generate their own videocall links. That
lead to send a Odoo discuss link to the customer, and then set the
google meet link in the sales person calendar.
As the insert of google event is done post commit of the transaction,
and there is no way to generate a google meet link before the creation
of an event, there is no trivial fix to generate the google mette link
at the right moment. We just don't generate the google link when a Odoo
discuss link is already there.
closesodoo/odoo#113192
X-original-commit: 1a1a8e48995cfe37a0c8536bbcfc3341d76499ef
Signed-off-by: Masereel Pierre <pim@odoo.com>
Before this commit: In some cases where some events won't sync to
Odoo properly you got the "Unable to use a closed cursor." error. The
problem is that `_from_google_ids` function returns a recordset, and the
underlying cursor may be closed.
Steps to reproduce the issue:
1. Create user_A and user_B in Odoo
2. Sync user_A and user_B with Google calendar
3. Create an event with user_B on the Google calendar
4. Run the "Google Calendar: synchronization" cron
5. Change the created event's owner to user_A on the Google calendar
6. Run the "Google Calendar: synchronization" cron
=> You will get this error on the log, and the event won't sync:
```
Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/api.py", line 886, in get
return field_cache[record._ids[0]]
KeyError: 99
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/fields.py", line 1061, in __get__
value = env.cache.get(record, self)
File "/home/odoo/src/odoo/odoo/api.py", line 889, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: 'calendar.event(99,).google_id'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/odoo/src/odoo/addons/google_calendar/models/res_users.py", line 91, in _sync_all_google_calendar
user.with_user(user).sudo()._sync_google_calendar(google)
File "/home/odoo/src/odoo/addons/google_calendar/models/res_users.py", line 70, in _sync_google_calendar
synced_events = self.env['calendar.event']._sync_google2odoo(events - recurrences, default_reminders=default_reminders)
File "/home/odoo/src/odoo/addons/google_calendar/models/google_sync.py", line 147, in _sync_google2odoo
existing = google_events.exists(self.env)
File "/home/odoo/src/odoo/addons/google_calendar/utils/google_event.py", line 180, in exists
events.odoo_ids(env)
File "/home/odoo/src/odoo/addons/google_calendar/utils/google_event.py", line 88, in odoo_ids
found = self._load_odoo_ids_from_db(env, model)
File "/home/odoo/src/odoo/addons/google_calendar/utils/google_event.py", line 111, in _load_odoo_ids_from_db
mapping = {e.google_id: e.id for e in odoo_events} # {google_id: odoo_id}
File "/home/odoo/src/odoo/addons/google_calendar/utils/google_event.py", line 111, in <dictcomp>
mapping = {e.google_id: e.id for e in odoo_events} # {google_id: odoo_id}
File "/home/odoo/src/odoo/odoo/fields.py", line 1087, in __get__
recs._fetch_field(self)
File "/home/odoo/src/odoo/odoo/models.py", line 3276, in _fetch_field
self._read(fnames)
File "/home/odoo/src/odoo/addons/calendar/models/calendar_event.py", line 436, in _read
super()._read(fields)
File "/home/odoo/src/odoo/odoo/models.py", line 3343, in _read
cr.execute(query_str, params + [sub_ids])
File "<decorator-gen-20>", line 2, in execute
File "/home/odoo/src/odoo/odoo/sql_db.py", line 89, in check
raise psycopg2.OperationalError('Unable to use a closed cursor.')
```
The solution is to use ormcache on a function that returns the ids of the
events.
opw-3098799
closesodoo/odoo#112517
X-original-commit: 831e2e916541a95a1b932d9f58b3592ecee0c685
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
Before this commit, when an event containing only the creator was created in Google Calendar, the creator's attendee status in Odoo was marked as 'needsAction'. Now, when an event like this is created (in Google Calendar), the event is automatically accepted in Odoo.
A test was added to make sure that new events with only the creator are automatically accepted.
closes odoo/odoo#112195
Task: 2782961
Related-to: #68700
X-original-commit: 6d0ead3d73477614dc1bd97a95b695f80925fdd3
Signed-off-by: Arnaud Joset <arj@odoo.com>
When we are creating an event in odoo and synchronise it with google,
the google meet link is not automatically generated. To ease the use of
the meeting, we'll auto generate the google meet link.
closesodoo/odoo#110847
Task-id: 2945998
Signed-off-by: Masereel Pierre <pim@odoo.com>
Before this commit: syncing with google led to sending emails to
attendees of existing future events on Odoo.
Steps to reproduce the first issue:
Install 'google_calendar' module
Integrate with Google Calendar in setting
Add an event to the Odoo calendar for future date
Add one external attendee to the event
Sync with Google
Invitation emails would be sent to the attendees of the events.
Solution
It's possible to not send emails to the attendees in api calls. So
the solution is to not send emails to the attendees for the syncing
time.
opw-2819046
closesodoo/odoo#102870
X-original-commit: 5a56e37a5f54662b1f3593930738e51c010abab7
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
Before this commit: if an event's attendee didn't have a state, it couldn't
get synced with Google.
The solution is first to set a default value for it.
opw-2915661
closesodoo/odoo#102865
X-original-commit: 89b53744c668183913b8a188730bd350fe778807
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
Before this commit: if one recurrence event in the google calendar
contains an attendee with one of the alias emails, it wouldn't get synced
and raise an error.
The solution is to remove those attendees.
opw-2963825
closesodoo/odoo#101037
X-original-commit: c9fa96604950f61c079627b88495130365d3b534
Signed-off-by: Arnaud Joset <arj@odoo.com>
Rename from google_cal_account_id to google_calendar_account_id, to have
the complete 'service' name into the field and allow to use it from a
generic way in oauth2callback from google_account e.g.
task-2497212
pr-95744
closesodoo/odoo#95744
Related: odoo/upgrade#3673
Signed-off-by: Christophe Simonis <chs@odoo.com>
This commit removes outdated method no more used since we delete oog
apps like gdrive.
This commit remove the logging of sensitive infos.
This commit allows to override easily api key.
task-2497212
pr-95744
Part-of: odoo/odoo#95744
There was an issue with this fix.
This reverts commit 8ebb44420c3e2dcc0d990d2646486654b4b2955d.
closesodoo/odoo#96421
X-original-commit: 29f0c7635c900324631fe3562399c3ced5bc15f7
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Before this commit: syncing with google led to sending emails to
attendees of existing future events on Odoo.
Steps to reproduce the first issue:
- Install 'google_calendar' module
- Integrate with Google Calendar in setting
- Add an event to the Odoo calendar for future date
- Add one external attendee to the event
- Sync with Google
Invitation emails would be sent to the attendees of the events.
Solution
It's possible to not send emails to the attendees in api calls. So
the solution is to not send emails to the attendees for the syncing
time.
opw-2819046
closesodoo/odoo#95781
X-original-commit: ac78ad6bf806ae3233ad38399771745edc8dc00d
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
Each user should be able to reset his own google calendar token.
An admin user (from `base.group_system`) should be able to reset any tokens.
Task-2673934
closesodoo/odoo#83397
Signed-off-by: Arnaud Joset <arj@odoo.com>
Before this commit: if a user is the attendee of an event containing
a private contact, the user couldn't sync with google calendar. Because
of the "res.partner.rule.private.employee" record rule restriction.
Steps to reproduce the issue:
1. Create users A and B
2. Enable "Access to Private Addresses" for user A and disable it for B
3. Login with user A
4. Integrate with Google Calendar in setting
5. Create a contact with private address (type = 'private')
6. Sync with Google Calendar in the calendar module
7. Create an event with user B and the private contact as attendees
8. Reset account of google calendar from user A setting
9. Login with user B
10. Try to sync with Google Calendar
=> You will receive an access error
The solution is not to allow any user to add private contacts as an
attendee. Also, create a new contact with the same email if it wants to
match existing private contact with a google event attendee.
opw-2850552
closesodoo/odoo#92624
X-original-commit: 96ee1ef45954bd27632da9c2cef3cf9ba44caca0
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
Current behavior :
When a Google Agenda event is created with "Show as" set to Available,
Show as (`show_as`) isn't set accordingly
Steps :
- Install Calendar
- setup and activate Google Calendar sync
- Create an event and set "Show as" on Available
- Refresh Odoo calendar to sync it
-> Created event "show as" is set to Busy
OPW-2805096
closesodoo/odoo#90261
X-original-commit: ff56f8126e105f2196843fed1646a3081f25aff3
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: Claude Thibault (thcl) <thcl@odoo.com>
Current behavior :
When a Google Agenda event is created with a meeting, the Meeting URL
(`videocall_location`) isn't set at creation.
Steps :
- Install Calendar
- setup and activate Google Calendar sync
- Create an event with a meeting via Google Calendar
- Refresh Odoo calendar to sync it
-> Created event doesn't contains a Meeting URL
OPW-2805096
X-original-commit: f85dfa2b3cb1fa03dcaa10b93fc5309b3a04eae6
Part-of: odoo/odoo#90261
Before this commit: When you sync the Odoo calendar with Google for the
first time, it will resync all of the created recurrence events with
Google after fetching all of the Google events. The problem is that it
chooses the 'accepted' state by default for the current user's state.
If you were invited to events and you hadn't accepted that, it would
update your status and send an email per event for all attendees.
Steps to reproduce the issue:
1. Create two new google accounts ( you'll bombard with emails)
2. Create a recurrent event without ending with the first account and
choose the second account as a guest.(don't accept)
3. Sync second account with Odoo
=> It'll send about 700 emails
The solution is to prevent synced recurrence events from syncing and.
opw-2691146
closesodoo/odoo#89633
X-original-commit: 084aeb239e85a4e3abb3e233af68c6838dfbb3d7
Signed-off-by: Arnaud Joset <arj@odoo.com>
To reproduce
============
- Sync Google Calendar to Odoo
- Create an event in GCaledar without setting a notification
In Odoo Notification reminder is set
Purpose
=======
we use default reminder given by Google which is notification 30 minutes before even if the event
doesn't have a reminder.
Specification
=============
To solve the issue we use empty reminder instead of the default given by google if no reminder is set.
opw-2792364
closesodoo/odoo#87592
X-original-commit: a25d38dd252a657ea44c822a227e415337003672
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: abla001 <abla@odoo.com>
Before this commit, when two users shared the same mail, they were ordered by alphabetical order.
This commit makes sure that the internal user is preferred.
closesodoo/odoo#84805
X-original-commit: 992b7a00f8eb567aed730420d0d10fa476fb9dd7
Signed-off-by: Thibault Francois <tfr@odoo.com>
Signed-off-by: Arnaud Joset <arj@odoo.com>
Before this commit, a lot of events and mail followers would be deleted and recreated.
This PR commit aims to identify the issue and fix it.
X-original-commit: d0adfb0b269d21a2284e9608c75bd6f1afffa9a8
Part-of: odoo/odoo#84805
In some cases, the module can patch an event but if it is deleted, some write will fails.
This fix prevent the following traceback:
```py
Traceback (most recent call last):
File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1057, in __get__
value = env.cache.get(record, self)
File "/home/odoo/src/odoo/15.0/odoo/api.py", line 889, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: 'calendar.event(30350266,).attendee_ids'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/odoo/src/odoo/15.0/odoo/api.py", line 886, in get
return field_cache[record._ids[0]]
KeyError: 30350266
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1057, in __get__
value = env.cache.get(record, self)
File "/home/odoo/src/odoo/15.0/odoo/api.py", line 889, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: 'calendar.event(30350266,).show_as'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/odoo/src/odoo/15.0/addons/google_calendar/models/google_sync.py", line 43, in called_after
func(self.with_env(env), *args, **kwargs)
File "/home/odoo/src/odoo/15.0/addons/google_calendar/models/google_sync.py", line 234, in _google_patch
self.need_sync = False
File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1217, in __set__
records.write({self.name: write_value})
File "/home/odoo/src/odoo/15.0/addons/google_calendar/models/calendar.py", line 55, in write
res = super(Meeting, self.with_context(dont_notify=notify_context)).write(values)
File "/home/odoo/src/odoo/15.0/addons/calendar/models/calendar_event.py", line 491, in write
previous_attendees = self.attendee_ids
File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 3389, in __get__
return super().__get__(records, owner)
File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 2603, in __get__
return super().__get__(records, owner)
File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1083, in __get__
recs._fetch_field(self)
File "/home/odoo/src/odoo/15.0/odoo/models.py", line 3276, in _fetch_field
self._read(fnames)
File "/home/odoo/src/odoo/15.0/odoo/models.py", line 3346, in _read
self.check_access_rule('read')
File "/home/odoo/src/odoo/15.0/odoo/models.py", line 3553, in check_access_rule
invalid = self - self._filter_access_rules_python(operation)
File "/home/odoo/src/odoo/15.0/odoo/models.py", line 3608, in _filter_access_rules_python
return self.sudo().filtered_domain(dom or [])
File "/home/odoo/src/odoo/15.0/odoo/models.py", line 5511, in filtered_domain
data = rec.mapped(key)
File "/home/odoo/src/odoo/15.0/odoo/models.py", line 5436, in mapped
recs = recs._fields[name].mapped(recs)
File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1176, in mapped
self.__get__(first(remaining), type(remaining))
File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1087, in __get__
raise MissingError("\n".join([
odoo.exceptions.MissingError: Record does not exist or has been deleted.
(Record: calendar.event(30350266,), User: XXX)
```
X-original-commit: 2f0c9ca75de616da61e327259d03a8831b8e159b
Part-of: odoo/odoo#83040
Before this commit, the following traceback could be encountered when events were deleted:
```py
Traceback (most recent call last):
File "/home/odoo/src/odoo/15.0/addons/google_calendar/models/google_sync.py", line 43, in called_after
func(self.with_env(env), *args, **kwargs)
File "/home/odoo/src/odoo/15.0/addons/google_calendar/models/google_sync.py", line 233, in _google_patch
self._google_error_handling(e)
File "/home/odoo/src/odoo/15.0/addons/google_calendar/models/google_sync.py", line 177, in _google_error_handling
start = self.start and self.start.strftime('%Y-%m-%d at %H:%M') or _("undefined time")
File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1087, in __get__
raise MissingError("\n".join([
odoo.exceptions.MissingError: Record does not exist or has been deleted.
(Record: calendar.event(28241777,), User: XXXX)
```
X-original-commit: e77cbc639032e7f58345942330102b37e7a55971
Part-of: odoo/odoo#83040
When an attendee is deleted in google, we need to sync the odoo attendees and delete the ones that do not exist anymore in google.
Unfortunately, by doing so, we introduced an issue. We filtered attendees that were no longer existing when we looped on the attendee emails.
```py
odoo.exceptions.MissingError: Record does not exist or has been deleted.
(Record: calendar.attendee(YYY,), User: XXX)
```
This commit ensure that we filter only existing attendees.
X-original-commit: 0fb1002c9bb027d1694b834c52e4492a03c8a09d
Part-of: odoo/odoo#83040
Description of the issue/feature this PR addresses: in version 15,
sometimes Google and Microsoft calendar synchronizations break with error:
Create/update: a mandatory field is not set.
Delete: another model requires the record being deleted. If possible, archive it instead.
Model: Calendar Attendee Information (calendar.attendee), Field: Contact (partner_id)
This is happening, because when Odoo is syncing an event, it will match
attendee with res.partner, if no existing partner is found, a new one
will be created unless:
- the address matches an existing mail alias ([alias_name]@[mail.catchall.domain])
- the address is invalid (eg. in outlook the email address is sometimes
in the form /o=ExchangeLabs/ou=.../cn=Recipients/cn=...
In this case we should not try to add the attendee to the odoo event.
Current behavior before PR: Error when syncing that the customer can
only solve by removing the erroneous attendee or remove the event from
their calendar.
Desired behavior after PR is merged: if the partner cannot be created
we ignore it.
opw-2670002
opw-2683889
opw-2702661
opw-2704631
opw-2711907
opw-2720032
opw-2722028
closes#82109fixes#78678closesodoo/odoo#82667
X-original-commit: 1cd470c8922119d0da0b69ab7d4b4ff746533689
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: yosa-odoo <yosa@odoo.com>
Co-authored-by: andro19951 <andro19951@gmail.com>
Small side effect of commit https://github.com/odoo/odoo/commit/b19dc634684aab239575b9a9e784c7420d110b7d
When deleting old attendees, we are removing the partner id associated with the email
from the partner_ids set on the event.
As the same partner can be set on more than one event, we need to loop only once
on each attendee email, otherwise we will face the error "Record does not exist
or has been deleted."
Also, when deleting partner_ids on an event, the attendee is already automatically
removed as well in _attendees_values method, there is no need to do it manually, as
it will raise the error a second time.
opw-2694428
opw-2695915
closesodoo/odoo#80828
X-original-commit: 766a1ad50a9dbc85ed2f9083f881781b7d5ec96c
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: Alex Thuyls (alt) <alt@odoo.com>
On large databases, the `postcommit` hook for Google|Microsoft Calendar
was taking up to 10% of a leave validation even if the user has the sync
disabled.
This commit disables the postcommit hook for new leaves, as the event will
be synced through the cron eventually.
closesodoo/odoo#80160
Taskid: 2693265
X-original-commit: 88884292e105eab2c36b2a334c617ac4978fa79c
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Refactor the Environments object into a Transaction object, which is
bound to one cursor, and is no longer shared among several cursors.
The following methods/properties have been changed:
- Environment.envs no longer works (because of the design change);
- Environment.manage() is deprecated (no longer useful);
- Environment.reset() is now an instance method;
- env.clear_upon_failure() is deprecated in favor of cr.savepoint().
closesodoo/odoo#75598
Related: odoo/enterprise#20451
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Co-authored-by: Xavier Dollé <xdo@odoo.com>
Before this commit, it was not possible to create events with defined attendee state. The default value was always set.
This was a limitation when the events were part of a recurrence and all events attendee needed to be created with a known state.
To reproduce, one would create a recurrent event, sync it with Google and in Google, 'decline' this event and the following.
The attendee state was not properly set.
closesodoo/odoo#68700
Taskid: 2484335
Related: odoo/upgrade#2537
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Before this commit, the calendar UX was not good enough. The look and feel was not modern.
This commit improves a lot of small details, remove unneeded or not mature features (like the videocall location url).
Counted recurrence now brings a better experience. When weekly or montly recurrences are created, occurences in the past are dismissed but before this commit their number was not adapted.
User would end up with less occurences than the provided number without explanations.
Taskid: 2484335
Part-of: odoo/odoo#68700
Before this commit, several token related data were stored on the res_users table. During event sync, the table could be locked and this commit aims to move these data to a dedicated table to avoid bottleneck effets.
Taskid: 2484335
Part-of: odoo/odoo#68700
This commit allows using different mail on the user and the partner without experiencing weird behaviors.
Before this commit, sometimes when user would set a different email on his user_id and his main partner, the sync event would not be visible as long as the event was not accepted in Google.
closesodoo/odoo#74903
X-original-commit: bca4532890432d994c0941042f4eff75485c87ce
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>