Before this commit, the account reset would fail with the following traceback:
```py
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/odoo/src/odoo/15.0/odoo/http.py", line 643, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/odoo/src/odoo/15.0/odoo/http.py", line 301, in _handle_exception
raise exception.with_traceback(None) from new_cause
AttributeError: 'res.users' object has no attribute '_set_auth_tokens'
```
This commit allows to use the wizard.
opw-2705169
closesodoo/odoo#80918
X-original-commit: 9f2aa5c87a9809899cba872e6a0428f86c687b9a
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Arnaud Joset <arj@odoo.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, the sync buttons refactored in https://github.com/odoo/odoo/pull/68700 would appears in all calendar views (sale,time-off,...).
This commit only displays them in the calendar event view.
closesodoo/odoo#75702
Taskid: 2633415
Signed-off-by: Yannick Tivisse (yti) <yti@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
UI changes:
* Improve the sync buttons. Before this commit, the buttons would be defined in JS and take more place.
* Improve the FieldMany2ManyTagsAvatar widget.
Taskid: 2484335
Part-of: odoo/odoo#68700
Before this commit, it was not possible to reapply all events in recurrence, delete all events of a recurrence or archive them.
This commit remove that limitation by reapplying the recurrence and remove all the existing events. When the events are synched, the action_mass_archive is used and it must ensure that only a request for the recurrency should be sent.
Individual request for each event are not sent.
Taskid: 2484335
Part-of: odoo/odoo#68700
Update query counters according to last runbot state. This helps spotting
query counters change linked to this PR.
Task ID-2377974
Community PR odoo/odoo#61467
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>
The license is missing in most enterprise manifest so
the decision was taken to make it explicit in all cases.
When not defined, a warning will be triggered starting from
14.0 when falling back on the default LGPL-3.
closesodoo/odoo#74245
Related: odoo/design-themes#48
Related: odoo/enterprise#19862
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Define `data-hotkey` on most used action buttons.
For the modals, the following keys are dedicated for "special"
actions:
- Alt+G: add
- Alt+V: save
- Alt+Z: cancel
closesodoo/odoo#73275
Taskid: 2588233
Related: odoo/enterprise#19464
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Before this commit, attendee were found based on the email sent by Google.
When multiple partners would match the mail, the first one was selected but we should favour the partner with a user.
The method _mail_find_partner_from_emails has this exact purpose and therefore is used.
X-original-commit: afabce8d20d574e07237d16fa01dea463979f705
Replace text fields to html fields as we have our own 'OdooEditor'.
Indeed, it gives more options to users in the way they format their
content without weighting too much on the UI
(tools appear on demand and not by default).
Adding a new method convert_online_event_desc_to_text
Because online events have fixed format for the description,
this method removes some specific html tags, and converts it into
readable plaintext (to be used in external calendars).
Models -> Fields
1) calendar.event -> description
Task Id: 2499504
X-original-commit: 0d5ca6a6fe8821b4ec19dd603bde116518721792
Before this commit, when the start datetime of base_event_id in recurrences was not set, a traceback would occurs when trying to notify the user.
closesodoo/odoo#71724
X-original-commit: d5b9403c0023d8df49487293b217c59265189a7a
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Arnaud Joset <arj-odoo@users.noreply.github.com>
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:
closesodoo/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>
Turn off calendar.attendees notification during synced_events creation
to improve performances. The calendar notification are only computed
once after all the synced events have been created.
Add a flag in google_calendar.js to avoid retriggering synchronization
while navigating the calendar view if the past synchronization is still
pending.
opw: 2450259 + fixes/adaptations to 14.3 branch
FW of https://github.com/odoo/odoo/pull/69619closesodoo/odoo#70035
X-original-commit: 28ccb2b88a7793058c81aabffb43071165886f40
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Arnaud Joset <arj-odoo@users.noreply.github.com>
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
closesodoo/odoo#69735
X-original-commit: 48cc3ed28e51ce34c1740f9b394d971234e0bdbe
Signed-off-by: Arnaud Joset <arj-odoo@users.noreply.github.com>
Each time the calendar view of event.calendar is loaded,
the synchronization with google calendar was launched
and if a user open many tabs, it can lead to deadlock
Solution: Check for lock before launching the synchro,
if the transaction cannot acquire the lock, it's proably
because another synchro already started
closesodoo/odoo#69540
X-original-commit: 101598fae6fc32a49bb6d422a82b621a81201cb5
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
With this commit we try to improve the way the events are displayed
to the user. Now, an event is displayed for each attendee of the event
that are selected in the filter. These events are displayed correctly
based on the status of the attendee in the event.
The colors displayed for the events now represent the attendees and not the
organizer.
If an attendee edit an event, it is edited for all others attendees.
Also, when an attendee that is not the organizer try to delete the event,
then the event is now declined in place of being deleted. If the organizer
delete the event, it is deleted for all attendees.
In case of an event where all attendees have declined it but the organizer,
the organizer see now a danger icon before the name of the event and it's
outlined and not filled with color, no matter of the actual status of the
organizer in the event.
task-2196775
COM PR: odoo/odoo#55190
ENT PR: odoo/enterprise#12196
UPG PR: odoo/upgrade#1532
Conversion of all modules to the new manifest assets declaration.
Part of task: 2352566
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
Purpose of this commit is to ease sending mail to attendees using template
by using a template record instead of an xml id. Indeed this allow having
flows using a configurable template instead of an hardcoded one.
Code in calendar_sms is split into main models to ease future improvements
related to SMS.
Taks ID-2191254
COM PR odoo/odoo#68443
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.
closesodoo/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>
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
closesodoo/odoo#66250
X-original-commit: 486f69abad6226e5ce016ad89a0eeb103d709a3f
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Purpose of this commit is to make templates easier to preview and edit as
weel as to improve their content.
This is achieved notably by lessening use of custom rendering context and
trying to fix as much error-prone jinja statements.
In this commit we also make ``calendar_template_meeting_reminder`` template
looking more like other templates. There were some rendering differences that
do not seem really wanted.
``calendar_template_meeting_reminder`` was also using an old ``force_event_id``
key not replaced by recurrent_id field on attendee.
This commit improves few strings of the invitation mail being sent while
booking an online appointment. Online appointment is computed based on
``appointment_type_id`` field being defined. Some tweaks in wording made it
necessary to know if recipient is the responsible, customer or an added
attendee on the event, leading to some tooling code added on event model.
The main changes includes
* for customer, remove the CTAs to accept / decline event as attendee are
automatically set as accepted;
* depending on recipient, improve wording of the mail accordingly and mention
appointment type in the mail;
Task ID-2199620
COM PR odoo/odoo#64925
ENT PR odoo/enterprise#15914
UPG PR odoo/upgrade#2282
Co-Authored-By: Krupal Oza <koz@odoo.com>
Co-Authored-By: Thibault Delavallee <tde@odoo.com>
When syncing Odoo with Google Calendar, if one Odoo event has an
attendee with an email address that contains some uppercases, it will
lead to undesirable behavior.
To reproduce the error:
(Need contacts)
1. Create an event
- In attendees, adds a new partner PA
- The email must be valid and the local-part must contain at
least one uppercase (e.g. demoUP@example.com)
2. Sync with Google
3. On Google Calendar, update the event (e.g., add a description)
4. Refresh Odoo Calendar
Error: The event is updated, but the attendee has been removed.
The error comes from both Google and Odoo.
Google Calendar is not case sensitive: if a user creates a meeting on
Google Calendar and adds an email address with uppercases, the latter
will be converted with lowercases. (On step 3, on Google Calendar, we
can notice that PA's email address does not contain any uppercase)
On Odoo side, when syncing the event, the module checks the attendees.
To do so, it uses email addresses from Odoo (with uppercases) and Google
(without uppercases):
https://github.com/odoo/odoo/blob/12cb76bdfe7a5affb7580485473be71cfa37658a/addons/google_calendar/models/calendar.py#L105-L114
`email` comes from Google and `attendees_by_emails` from Odoo.
Therefore, it will consider the email as a new attendee and will run
`find_or_create` to get the associated partner. However, this method
uses the normalized email address to find the partner:
https://github.com/odoo/odoo/blob/12cb76bdfe7a5affb7580485473be71cfa37658a/addons/mail/models/res_partner.py#L50-L63
Thus, `find_or_create` returns PA and adds the latter to the attendees
and partners (even if PA already exists in partners and attendees).
After that, the module checks if some attendees must be removed:
https://github.com/odoo/odoo/blob/12cb76bdfe7a5affb7580485473be71cfa37658a/addons/google_calendar/models/calendar.py#L115-L120
Again, `odoo_attendee` comes from Odoo and `email` comes from Google.
Therefore, it will remove PA from attendees and partners.
This explains why:
- PA has disappeared
- No partner has been created for the email address without uppercase
This fix suggests to normalize the Odoo email addresses each they are
compared with the Google ones.
OPW-2464863
closesodoo/odoo#67950
X-original-commit: 01648d37b9d5ad858d3b60dacfb724a18045f007
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
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
closesodoo/odoo#67840
X-original-commit: 735614a127499843bc7bd701794870234e743a88
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
This commit improves multiple small details in the calendar application.
UI, UX mostly:
* some labels were confusing
* the invisible attribute were not set in popover view
* the sample data were missing
* ...
taskid: 2342252
For odoo-master Transifex project, no demo data
closesodoo/odoo#66500
X-original-commit: 813931ac850e5ba4181259a5957ec72226fb670c
Related: odoo/enterprise#16510
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
When syncing with a Google account, if user's email is different from
Google account, the server creates a new partner. Moreover, the synced
event are not linked to the current partner.
To reproduce the error:
1. Have two Google accounts GA01 and GA02
2. With GA01, add an event to Google Calendar and add GA02 to guests
3. In Odoo, sync with Google Calendar using GA02
- The partner linked to the current Odoo user must have an email
different from GA02's email
Error: The calendar is synced, but the user needs to check "Everybody's
calendars" to see the synced events. A new partner has been created
using GA02's email. The synced events are linked to this new partner
instead of current user's partner (`self.env.user.partner_id`).
Moreover, Google event's organizer is always added to attendees but, if
it this is indeed the case (so if the organizer is also an attendee),
`google_event.attendees` already contains this organizer.
OPW-2440033
closesodoo/odoo#65630
X-original-commit: 12cb76bdfe7a5affb7580485473be71cfa37658a
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
When synced with Google, if a user adds an event to Odoo Calendar, both
Google and Odoo will send an invitation to attendees.
To reproduce the error:
(Need mailcatcher)
1. Sync Odoo Calendar with Google Calendar
2. Create an event in Odoo Calendar
- Add at least one attendee who has an email address
3. Save
Error: Odoo's server sends an email. When synced, it should not, it
should let Google in charge of emails sending.
(Similar to #62383)
OPW-2440485
closesodoo/odoo#65125
X-original-commit: c0a2729d4b7ba6fefe4dbde9247b2e6e868f5771
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
When using the Calender synced with Google, if the user tries to delete
an event, an error message is displayed: he has to archive it instead.
To reproduce the error:
1. Sync Odoo Calendar with Gogle Calendar
2. Add an event
3. Click on it > Delete
Error: UserError message: "You cannot delete a record synchronized with
Google Calendar, archive it instead"
To make the flow simpler and faster, when clicking on "Delete", the
server will archive the event. When archiving an event, the server
deletes the corresponding event on Google Calendar. As a result, the
next time the user loads his Odoo Calendar, the sync Google->Odoo will
delete the archived event.
OPW-2440339
closesodoo/odoo#64957
X-original-commit: 109ffab4a5d3e77d330d7fa4cc5fd39017bdf561
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
Currently when creating a calendar.event with google sync switched
on and without adding another attendee, the event is immediatly
removed from the calendar view. This is because the user_id is filtered out
of the attendee_ids before sending the values to google calendar. Then, at
the next sync, google response attendees list does not contain the user_id
so Odoo turns that into a [(3, id)] command. Thus, the corresponding event
disappear from the current calendar view even though it is still in the DB.
This fix is essentially the same as the one implemented in the
microsoft_calendar addons available from 14.0 onwards. It adds the
calendar owner if the event organizer is not null. This way, even
though the owner is not sent as an attendee, it is not removed
after google's response.
closesodoo/odoo#63190
X-original-commit: 04aa586a53c2b78cf6646d96d29cbd1e8969de3f
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Add the possibility to stop/restart the synchronization with
Google Calendar.
Change the calendar event popover of the calendar view to
display an 'Archive' button if the event was synced at least
one.
Add some tests for the new stop/restart features.
When the database is migrated from 13.3 to 14.0, the write_date is not set on the 'calendar.event' records.
During the syncing with google api, the write-date is compared to take the more recent values, leading to an inevitable crash for recently migrated databases.
closesodoo/odoo#63007
Taskid: 2389374
X-original-commit: e1493af550bd425ca682e4db707e5a490d3d4af8
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
With this commit, all instances of errors being raised inside
`BaseModel.unlink` overrides are moved into methods decorated with
`api.ondelete` which is safer.