Commit Graph
19 Commits
Author SHA1 Message Date
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
Arnaud Joset 24a36c6c8f [IMP] calendar: rename calendar.contacts model
Before this commit, the 'magic' model calendar.contacts name was misleading. This model is only used to save calendar view preferences in the calendar app.
As the calendar events are already mentionning attendees, partners, users, the 'contact' name for a technical field was confusing.

Taskid: 2484335
Part-of: odoo/odoo#68700
2021-08-26 10:20:59 +00:00
Anh Thao Pham (pta) 4b4e258c4c [FIX] calendar: access rights of calendar attendee for portal user
Removing default read/write access rights on Calendar Attendee Information for Portal User.

opw-2325322

closes odoo/odoo#57314

X-original-commit: 7df6583dba5d4d11664c21979bfb4f926fabce16
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
2020-09-09 06:39:30 +00:00
Yannick Tivisse 1a9be3a869 [REF] calendar: Lint + Clean code 2020-04-09 10:59:34 +02:00
Lucas Lefèvre a27afdb543 [REF] calendar: Materialize virtual recurring events
TL;DR A bit of magic and ... Pouf ... all virtual events are now real records.

Purpose
=======
The current implementation of recurring events uses "virtual events" to represents all
events in the recurrence. Only one event is stored in the database. All other events are
dynamically built and sent to the web client which sees them as real records.
This implementation is old, difficult to read (6 years of changes and bug fixes) and
has become more and more difficult to maintain.
A fresh start would be welcome.

Specification
=============
When creating a recurring event, a `calendar.recurrence.rule` record should be created.
This model holds the rrule configuration and is responsible to manage events that result
from the rrule.
When a new recurrence is created, all resulting events are also created (stored in the
database). No more virtual events.
To avoid an explosion of events, a maximum of 720 events is created. With 720 events,
a daily recurrence lasts for 2 years and a weekly recurrence lasts for 15 years.
This strategy is used by Google Calendar and seems acceptable in most cases.
A cron job could eventually be introduced to generated more events as the end comes.

This allows to introduce an new rrule end type: 'Forever'. This is actually a shortcut
to create a recurrence running for 720 events.

Inspired by Google Calendar, new possibilities are introduced when modifying a recurring
event (e.g. change the name, add an attendee):
- Modify only this particular event (the event is still part of the recurrence)
- Modify this and following events (events are still in the same recurrence)
- Modify all events

In a similar way, when updating the rrule of an event (e.g. from every Monday to every
Tuesday), the user can choose to:
- Modify this and following events: the recurrence is split. The first part remains
  unchanged but now ends when the second recurrence begins. The second parts is the
  updated rrule.
- Modify only this particular event.
- Modify all events: Forbidden (same as Google Calendar)

Note: when events are "moved" because the rrule changed, the events are not actually
moved. They are unlinked and new events are created (See "Some design choices explained"
section).

Some design choices explained
=============================

Where to store the rrule?
-------------------------
Two options were considered.
1) Store the rrule on an event, each event of the recurrence having a Many2one
to the parent_id, aka the Master Event of the recurrence.

2) Store the rrule on another model: `calendar.recurrence.rule`. Each event in the
recurrence having a Many2one to the recurrence record.

Both options have pros & cons. But there is no clear winner.
However the actual business logic of handling the recurrence creation/update
would be the same.
Where the rrule configuration is stored is the only main difference between both options.
And this is probably the easiest part of implementing recurring events.

With that in mind, option 2) is chosen. It allows to clearly separate recurrence
logic from the events themselves. It is also the "correct" way of modeling data to avoid
many empty columns for most records.

Reusing events on rrule update
------------------------------
When an rrule is modified, events should also be updated.
In most cases, current events are unlinked and new events are created from scratch.
Only events exactly at the same time before and after the rrule update are kept.
Trying to reuse other events would require an obscure and arbitrary heuristic.
(Imagine an rrule every Monday that is changed to every Tuesday and every Friday.
What would you do?).
This implies that any change to a specific event (name change, attendee added, chatter
messages) is lost. This tradeoff seems acceptable as updating an rrule should not be
that frequent. Moreover, Google Calendar also works that way so why not Odoo?

Reusing events on events shifts
-------------------------------
On the calendar view, drag and drop an event to shift the entire recurrence.

One way to handle the recurrence shift is to apply the same timedelta to all events.
Now events are correctly positioned... except for events that were specifically
moved. Those outliers needs special handling.
This also introduces some behavior inconsistencies:
when an rrule is directly modified, events are not reused, but when the rrule is
modified by drag & dropping an event, events are reused. This option needs more code to
handle the shift and the behaviors are not consistent.

The chosen option is to find the rrule configuration from the dragged event (this is
easy) and update the recurrence with those new rrule values. This brings us back to
an rrule update (see above): code reusability yeah; one behavior to rule them all yeah.
One downside is that outliers are lost (but Google Calendar also works that way).

Task 2126717
PR #42031
PR Enterprise odoo/enterprise#8006
2020-04-09 10:56:37 +02:00
Christophe Simonis 03f9514af0 [FIX] calendar: adapt new ir.rule to use renamed field 2017-01-18 16:42:36 +01:00
Christophe Simonis f0a5618e61 [MERGE] forward port branch saas-11 up to 6169018c33 2017-01-18 16:21:55 +01:00
Nicolas Martinelli 23b2bba925 [FIX] calendar: private events
By default, an event can be modified by any employee. This is also the
case for private events, displayed as "Busy" to other users. However,
since any user can modify an event, nothing prevents him to change the
privacy setting in order to be able to see the content.

This commit introduces a global record rule which only allows the
followers of an event to modify it.

opw-705079
2017-01-18 14:49:22 +01:00
Jérome Maes 6bc14c9142 [MIG] calendar: migration to new API
Migration of all python code, mostly withtout chagnes. And adapting
xml files to guidelines.

On calendar.py, some changes have been perform to make the migration works :
- `_compute` method has been split into `_compute_dates`, `_compute_attendee` and `_compute_display_time`.
- remove unused method `onchange_partner_ids`, `check_partners_email`
- make `compute_rule_string` use a cache record instead of a value
dict to avoid crashes
- remove `new_invitation_token` method, and make it a default value on attendee creation
- add a default value on `day` field, otherwise the "Please select a
proper day of the month" exception is raised during the onchange
2016-07-14 14:04:33 +02:00
Yannick Tivisse 9e57185449 [IMP] base,sales_team: Move res_groups and menuitems to sales_team
Purpose:
Having the res_group defined in base and sales_team auto installed
with mail doens't make sense.

- Move the empty res_config class and the related view from
  base_setup to sales_team (base_setup only contains the 'General Settings'
  model and views
- Move the 'sale' related content from product to sale module (Access rights,
  menuitems,...)
- Set sales_team at autoinstall False. The module is installed when needed by
  crm or sale for example
- Set sales_team as a dependency of voip. (Access rights defined for configuration
  purpose)
- Set sales_team ad a dependency of subscription (Access rights issue too)

[FIX] account: move some ir.model.access to sale module
[FIX] payment: Move some ir.rule to website_sale
[FIX] stock: move some ir.model.access rule to sale_stock
[FIX] project: Move some ir.model.access rules to crm_project_issue
[FIX] mrp: Move some ir.model.access rules to sale_mrp
[FIX] calendar: move some ir.model.access rules to crm

Rename xmlids accordingly. Example: 'base.group_sale_manager' becomes
sales_team.group_sale_manager.

[ADD] sales_team: See own documents => See only his sales team
Moved the "User: Own Leads Only", "User: All Leads" and "Manager" groups from sale and crm
into sales_team module. Add the record rules so that user can see only his Own Sales Team
if "See Own Leads" is sales right and can see all sales teams if he is having sales rights
of "See All Leads" or manager.
2016-06-09 16:05:25 +02:00
Yannick Tivisse ccdb5cbfc0 Revert "[IMP] base,sales_team: Move res_groups and menuitems to sales_team"
This branch need more testing instead of doing 10 fixes. A lot of issues are occuring
when installing modules in different orders.

This reverts commit fa6e415cdb.
2016-06-06 17:26:30 +02:00
Yannick Tivisse fa6e415cdb [IMP] base,sales_team: Move res_groups and menuitems to sales_team
Purpose:
Having the res_group defined in base and sales_team auto installed
with mail doens't make sense.

- Move the empty res_config class and the related view from
  base_setup to sales_team (base_setup only contains the 'General Settings'
  model and views
- Move the 'sale' related content from product to sale module (Access rights,
  menuitems,...)
- Set sales_team at autoinstall False. The module is installed when needed by
  crm or sale for example
- Set sales_team as a dependency of voip. (Access rights defined for configuration
  purpose)
- Set sales_team ad a dependency of subscription (Access rights issue too)

Rename xmlids accordingly. Example: 'base.group_sale_manager' becomes
sales_team.group_sale_manager.
2016-06-06 15:46:52 +02:00
Kersten Jeremy f3c01647d7 [FIX] Add missing security rules
bzr revid: jke@openerp.com-20140505154309-whfdzf7suf8307vd
2014-05-05 17:43:09 +02:00
Kersten Jeremy 4ce7e8c6dd [FIX] Fix access rule for portal. Add timezone in small calendar from email
bzr revid: jke@openerp.com-20140505124657-t6gxusxkkgon06hf
2014-05-05 14:46:57 +02:00
Richard Mathot (OpenERP) 4babe341d9 [REM] Removing outdated access rights, that can cause crash of calendar module at install
Moreover, authorizations for the display of surveys should reside in the 'survey' module

bzr revid: rim@openerp.com-20140120095213-73niqv07xap3uyq9
2014-01-20 10:52:13 +01:00
jke-openerp 46b0c7aa00 [REF] Rename model crm.meeting into calendar.event
Remove 2 unsused field from calendar.event model (dir,sequence)

bzr revid: jke@openerp.com-20140115093805-1g1j1oymyxsb6kgh
2014-01-15 10:38:05 +01:00
jke-openerp 656f8241d5 [REF] Refactoring according to the first review of CHS
bzr revid: jke@openerp.com-20140110170912-im9p7j5wf229k4d6
2014-01-10 18:09:12 +01:00
jke-openerp 6bb986a2e5 [FIX] Fix according to APR's Review
- Access Right too restrictif for user
- Bug UI between Firefox and Chrome
- Bug UI many2many_tag cursor on bullet
- Temp Fix on email_template to manage partner_to
- Manage attendee from hr_holidays 
- Manage avatar_model in sidebar_items for filter (res.partner was hard coded)
- Remove quick add from HR-holiday, because some field (as day) is calculated on event "onchange"

bzr revid: jke@openerp.com-20131220141855-mbhxtr07fn0sroe0
2013-12-20 15:18:55 +01:00
jke-openerp dd285d23af [TYPO] Rename base_calendar into calendar
bzr revid: jke@openerp.com-20131219144739-9ic700ycef8uklbc
2013-12-19 15:47:39 +01:00