Commit Graph
17 Commits
Author SHA1 Message Date
Jeremy Kersten 05b409f8f1 [REF] google_account, google_calendar: clean and make it overridable
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
2022-08-10 14:43:01 +02:00
pedrambiria 8b6341c1ff [REV] google_calendar: not sending emails to existing event attendees"
There was an issue with this fix.

This reverts commit 8ebb44420c3e2dcc0d990d2646486654b4b2955d.

closes odoo/odoo#96421

X-original-commit: 29f0c7635c900324631fe3562399c3ced5bc15f7
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-07-21 00:50:39 +02:00
pedrambiria fb36e02de5 [FIX] google_calendar: not sending emails to existing event attendees
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

closes odoo/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>
2022-07-12 07:31:41 +02:00
Fabio Barbero fc79bd1e0e [IMP] sm modules: "neutralise" genders
Purpose
=======
Change all masculine nouns in Odoo's code to neutral nouns (when
possible), making sure that demo data is correctly handled. This is
particularly important since our code is open source, and nowadays lots
of machine learning models are trained on open source repositories.

With this small change we contribute to training more "fair" models, and
teaching models that "employee" or "user" != "he".

This also affects some text visible by the user, hence making it more
inclusive for Odoo users.

Task-2853046

closes odoo/odoo#91292

Related: odoo/enterprise#27302
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-05-16 10:09:32 +02:00
thcl-odoo b6e08d662d [FIX] google_calendar: add show_as on sync
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

closes odoo/odoo#90261

X-original-commit: ff56f8126e105f2196843fed1646a3081f25aff3
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: Claude Thibault (thcl) <thcl@odoo.com>
2022-05-04 10:55:47 +02:00
thcl-odoo a784ddab33 [FIX] google_calendar: add Meeting URL on sync
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
2022-05-04 10:55:46 +02:00
Rémy Baranx (bar) 846367530a [FIX] google_calendar: empty event name in google calendar
As explained at https://github.com/odoo/odoo/blob/171e42e380a46463b4359166955dc4c5f6ccf42e/addons/google_calendar/models/calendar.py#L206,
When there is no Odoo user who is the owner of the updated event,
modification are limited to some fields only.

In this case, that means we must use the `PATCH` method instead of the `PUT`
one to avoid erasing all not modified fields such the event name.

opw-2694739

closes odoo/odoo#81341

X-original-commit: 960e63a75350c28f186e55d69bffea6d51dcf7f1
Signed-off-by: Arnaud Joset <arj@odoo.com>
2021-12-17 10:10:49 +00:00
Arnaud Joset 40fd44f618 [IMP] calendar,google_calendar,microsoft_calendar: Improve UI
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
2021-08-26 10:21:02 +00:00
fw-bot 05446fcc99 Cherry pick of 3c8bdde81d508fdee301f13bcbc6e4eefc9fb02c failed
stdout:

stderr:
17:49:30.703303 git.c:344               trace: built-in: git cherry-pick 3c8bdde81d508fdee301f13bcbc6e4eefc9fb02c
error: Cherry-picking is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: cherry-pick failed
----------
status:

closes odoo/odoo#71390

X-original-commit: 7033f4aa7d1c65ad13dcd19e66378b101b56238b
Signed-off-by: Arnaud Joset <arj-odoo@users.noreply.github.com>
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-05-28 13:12:42 +00:00
Adrien Widart b6fc91d243 [FIX] google_calendar: force notification sending
Suppose both Google Calendar and Odoo Calendar are synced. Google will
not send any invitation to attendees when the user creates an event from
Odoo.

This fix requires Google to notify attendees when an event is created,
modified or cancelled.

OPW-2501413

closes odoo/odoo#69735

X-original-commit: 48cc3ed28e51ce34c1740f9b394d971234e0bdbe
Signed-off-by: Arnaud Joset <arj-odoo@users.noreply.github.com>
2021-04-23 09:10:40 +00:00
Lucas LefèvreandArnaud Joset 13e50b8e6a [FIX] google_calendar: events sync issues
Before this commit:

The google synchronization dis not properly synced event in some conditions. Some use cases were not properly tested.

Recurrent events were regularly badly synchronized with Google.

Several issues occured:
 - events not follow recurrence were duplicated on both Google or Odoo and sometimes deleted when the recurrence was reapplied.
 - the base_event (first event of the recurrence) was duplicated
 - miscalculation of the event google_id when they were part of a recurrence but did not followed the rrule.
 - improper data handling from google. Odoo objets were created with incorrect values
 - attendee state was not properly sync from Odoo to Google
 - whole recurrence deletions from google were not properly sync in Odoo
 - when time fields of a recurrence were modified on Google, modifications were ignored on Odoo
 - Event timezone were not properly saved on the recurrency. (Odoo saves it on the recurrency and Google on the event)
 - Odoo considered that all public events are writable bu Odoo users. That would trigger errors as Google implement an access right model on public events
 - lack of tests
 - a lot of weird behaviors resulting from these problems.

closes odoo/odoo#68412

Taskid: 2456498
Opw: 2299834
X-original-commit: dcfc8b7896f079e8e4474392807d9c53cb7e94f3
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Co-authored-by: Lucas Lefèvre <lul@odoo.com>
Co-authored-by: Arnaud Joset <arj@odoo.com>
2021-03-29 07:47:14 +00:00
Thibault Francois 30f4be4889 [FIX] (google|microsoft)_calendar: make sync more resilient
Issue
-----
- Currently the cron can take too much time and timeout.
  In case of timeout process data are rollback.
  The sync per user also crash and stop the process for all user and make
  the transaction rollback

  In both case we cannot ensure that all user will end up synchronized

- The real time sync can end up in deadlock:
  If you create a holiday, it trigger a write on the user and the
  creation of an event that will be synchronize with google

  The synchronization may ask for a new token if this request fail
  a new cursor is create to empty on the user the refresh token.
  2 cursor that are trying to write on the same record => Deadlock

- Bad refresh token management
  When the refresh token is not anymore valid it's erased but
  the calendar_token and validity are kept. Is odoo consider
  the token valid it will try to sync an event with google|microsoft
  despite the refresh token is not valid anymore. Of course this lead to
  an error and the impossibility to create an event anymore without
  manually wiping the calendar_token and calendar_token_validity

- Error 401 are handled in context manager
(google|microsoft)_calendar_token, but get_*_calendar_token never raise
http error only user error.

Solution
---------

- Improve cron resilience
	- Commit between each user and rollback in case of issue for a user
	- Solve the issue when stop < start
        - Solve issue with rrule not being the first element in the list
          of recurrence
	- Improve perf when searching for organizer
	- In order to limit the volume during the first synchronization, we only
	synchronized event from x days in the past to x days in the future with
	x = 365 by default
	- Limit the number of event to synchronize to google each time to 200,
	since this operation is time consuming (1 request is sent per event)

- Avoid deadlock
  A new cursor is not needed, we only need to ensure that write on the
  user is done with a clean cursor and will be commited despite the error
  raise. So rollabck before the write and commit explicitly afterwards

- Erase properly all the token and the token validity if the refresh token is not valid anymore
	- For google calendar, erase also the token in case of 401
          error: Wrong client id, this mean the database parameter have been
          change and all the user should reconfigure the synchronization

- Directly handle error 401 with error 400 in refresh_token method

closes odoo/odoo#66250

X-original-commit: 486f69abad6226e5ce016ad89a0eeb103d709a3f
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-03-25 09:55:10 +00:00
Yas-Elak 2d0343bcc3 [FIX] google_calendar : check user_id before calculating ownership
Issue:
If we get a 'false' for the real_owner_id from the extendedProperties, we will get an error
ValueError: invalid literal for int() with base 10: 'false'

Fix:
We make sure to set a user for the real_owner_id var if it return a 'false' before

closes odoo/odoo#67840

X-original-commit: 735614a127499843bc7bd701794870234e743a88
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2021-03-15 11:37:07 +00:00
Victor Feyens c482fdbf05 [IMP] various: improve code style and performance by improve `all()` usage
PURPOSE

Clean code. Be more performance oriented.

SPECIFICATIONS

Improvements applied in this commit

  * not all() --> any(not) for earlier returns;
  * all([generator]) --> all(generator) to avoid unnecessary list casting.
    This code construct is better managed by all;

This commit will probably not have a big performance effect on standard
production databases. However each performance and cleaning improvement
is welcomed.

LINKS

Task ID-2328619

closes odoo/odoo#56810

X-original-commit: 1cc6bb1231401ea7f501d2f5b5e9641ec8734850
Related: odoo/enterprise#12802
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-08-31 13:59:27 +00:00
Julien Castiaux d6d0e8d6d2 [FIX] models.py: remove leftover import crm like compatibility
Historically, it was possible to import addons via a naked import. It is
no more possible since 9e1f13bac, since that commit, the only possible
way to import odoo addons is via the `import odoo.addons' prefix.

closes odoo/odoo#46995

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-05-14 14:40:02 +00:00
Yannick Tivisse 1a9be3a869 [REF] calendar: Lint + Clean code 2020-04-09 10:59:34 +02:00
Lucas Lefèvre ae3d37c201 [REF] google_calendar: Refactor synchronisation
This commit refactors calendar synchronization between Odoo and Google after the
main calendar application refactoring.

This refactoring takes advantage of two new features from the Google API:

- New way of synchronizing resources efficiently[1]
Incremental sync is performed repeatedly and updates Odoo with all the changes that
happened ever since the previous sync. Each time, Odoo provides the previous sync
token it obtained from Google and stores the new sync token from the response.

- Event metadata[2]
Ability to set hidden key-value pairs with an event, called extended properties.
These extended properties are used to store the related odoo event id and the Odoo
owner id (see known limitations)

Known limitations
=================
- Let A and B be two new users (no tokens available). A creates an event in Odoo and
invites B. A is the owner of the event (user_id). Now B authenticates to his Google Calendar
account and synchronizes his calendar. We cannot send the event to A's calendar since we
don't have any access to his Google Calendar. Hence the event his sent to B's calendar.
This leads to data de-synchronisation: The owner is A in Odoo but B in Google.
The "real" owner (user A) is stored in the Google event's metadata to be able to
reconcile the owner for following synchronizations.

- Let A and B be two users of Odoo and Google Calendar. And let the Google Calendar of B
be private (e.g. if A creates an event in Google Calendar and invites B, B won't see the
event in his calendar). If A creates an event in Odoo and invites B. The event is synced
to Google Calendar of A. Now B can see the event in Odoo but he can't see it in his
Google Calendar.

Task 2126717
PR #42031
PR Enterprise odoo/enterprise#8006

[1] https://developers.google.com/calendar/v3/sync
[2] https://developers.google.com/calendar/extended-properties
2020-04-09 10:59:33 +02:00