Commit Graph

110 Commits

Author SHA1 Message Date
Jeremy Kersten e8019a23c2 [FIX] calendar: fix end recurrency date for yearly event
Event with interval > 1 was not correctly computed.
This patch doesn't fix existing event but only the new one created after this fix.

Event 1/1/2015 repeat every 3 months, 6 times
Before this commit : end recurrency = 1/1/2015 + 6 * 1 month
After this commit:   end recurrency = 1/1/2015 + 6 * 1 month * 3 (interval)

This commit closes #14332
2016-12-20 21:12:19 +01:00
Jeremy Kersten 659d68add5 [FIX] calendar: fix retrocompatibility between datetime module
Fix datetime where the return of rrule is sometime a list,
sometime a set according to the datetime version.
list(set) == list(list) and works in both cases.

Similar fix: #9f09c62
2016-12-20 21:12:10 +01:00
Martin Geubelle 9f09c625f5 [FIX] calendar: rule._bynweekday can be a set
Depending on the version of dateutil, rule._bynweekday can either be
a tuple or a set (see https://github.com/dateutil/dateutil/pull/54), which,
in the case of a set, breaks the access by index (see related issue:
https://github.com/dateutil/dateutil/issues/24).

By casting it into a list, we make sure that we can access [0] in both case.

Credits to jke ; closes opw-690761.
2016-10-28 11:26:23 +02:00
Jeremy Kersten 3418b9f8aa [FIX] calendar: avoid infinite recurrent event
Old check was always ignored since 0 is False.

This commit closes #12715

Other fix; when we detach an event, we reset the rrule_type to avoid to have a
warning popup (about empty final_date) if the old one value was end_date.
2016-07-25 15:48:25 +02:00
Christophe Simonis 7e51d98553 [FIX] calendar: correct search on mail.message and ir.attachment
Handle the case of immutable (tuple) domain leafs.
2016-04-26 14:55:41 +02:00
Denis Ledoux 461162f3ec [FIX] calendar: display_start and stop are not private
Add `display_start` and `display_stop` to the fields
which are public even if the event is marked as private.

There is no reason it should be public,
especially if `start` and `stop` are. Besides,
this leads to issues in
`get_search_fields`, when doing:
```
sort_fields['sort_start'] = browse_event['display_start'].replace(' ', '').replace('-', '')
```
opw-672997
2016-03-29 16:13:07 +02:00
Denis Ledoux 0eb9772ab8 [FIX] calendar: rrule computation of private events
If an event is private, a bunch of fields
are hidden for the users not being
the owner of the event, even for sudo.

The fields on which depends the `rrule`
computation were part of the hidden/private
fields.

In addition, the `rrule` is always computed
as sudo. See `_get_rulestring`.

Therefore, the `rrule` of recurrent private events
was not correctly computed when the owner wasn't
the administrator.

opw-670295
2016-02-25 15:21:42 +01:00
Raphael Collet 70fdb5a26e [FIX] calendar: in method write(), process all records and not the last one only 2016-01-22 17:12:09 +01:00
Denis Ledoux 11c312182f [FIX] google_calendar: sync when chenging the recurrency only
When changing anything regarding the recurrence,
e.g. the number of repetitions, the weekdays, ...
the event require an update by Google side

As the `rrule` is a computed field, we need to mark
the event as needing an update by Google side as soon
as one of the fields on which depend the `rrule` field
is updated.

opw-659963
2016-01-08 18:13:11 +01:00
Martin Trigaux 1c5c255186 [FIX] calendar: translatable date content
The time_display is present in a translatable email template but was not
translated. Added the missing term.

Updated .pot file for a few missing terms.
Removed base_calendar.pot that has no reason to be in 8.0

Fixes #9573
2015-11-25 14:36:55 +01:00
Nicolas Lempereur 898cae5684 [FIX] calendar: manage export of recurring event
When we export a recurring event, there was an error since there is
virtual ids (like '{real_id}-{date_of_the_event}').

Events steming from a recurring events are in fact shown virtually. In
the database there is really only one event and a suffix is appended to
the id to target a given instance of a recurring event.

If we want to separate a recurring event from the instances, we can edit
the instance and use the link "Update only this instance", once done
this instance is separated for the recurring event.

This commit if one or more recurring events instances are selected when
an export is done, will only export one source event of each of the
events occurences.

fixes #7932
closes #8262
opw-647676
2015-08-28 17:24:47 +02:00
Christophe Simonis e8076c3854 [MERGE] forward port of branch saas-3 up to 5c7190c 2015-07-29 12:11:20 +02:00
Christophe Simonis 5c7190c93f [MERGE] forward port of branch 7.0 up to cb29f9e 2015-07-29 12:07:34 +02:00
Martin Trigaux 5792e4063b [FIX] calendar: bad field label 2015-07-28 14:07:48 +02:00
Goffin Simon e0ceab9efd [FIX] calendar: group_by with calendar
Delete the code introduced by 656f8241d5
Group by didn't work in calendar tree view, group of records showed (0)
as number of related records for each group.

closes #7602
opw:644735
2015-07-20 15:41:47 +02:00
Lorenzo Battistini f27acff15a [FIX] calendar: missing ondelete cascade
calendar.attendee record should not exist without calendar.event
2015-07-09 16:06:28 +02:00
Christophe Simonis ed3065e3c6 [MERGE] forward port of branch saas-3 up to b7f9f4a 2015-06-18 19:33:19 +02:00
Christophe Simonis b7f9f4ade0 [MERGE] forward port of branch 7.0 up to e8e3f75 2015-06-18 19:29:47 +02:00
Denis Ledoux 7d69759e73 [FIX] calendar: display event reminders
This issue is related to 4f03a6224d.

The above revision aimed to not fetch uselessly fields values

The thing is, `partner_id` of `get_next_potential_limit_alarm` method
expects a partner id, while partner['id'] is actually a user id.

The `partner_id` of the user must be taken, not the user id itself.
2015-05-20 15:49:36 +02:00
Denis Ledoux bac5b87b73 [FIX] calendar: update cron as SUPERUSER.
As regular employees are not allowed to
alter cron activities.

opw-639419
2015-05-19 11:04:30 +02:00
Denis Ledoux 4f03a6224d [FIX] calendar: calendar_last_notif_ack is not user self readable.
`calendar_last_notif_ack` is not in the self readable fields list
of `res.users`. See `SELF_READABLE_FIELDS` in res_users.py.

This field must therefore be read as SUPERUSER.

opw-634402
2015-05-12 12:21:56 +02:00
Jeremy Kersten 2e49fc09ff [FIX] calendar: set context if none
Avoid traceback if no context in get_recurrent_date_by_event when code do:
    context.get('xx')
2015-05-11 10:41:02 +02:00
Denis Ledoux d13ca06c8e [FIX] calendar: message_(un)subscribe expects integers
In calendar, using recurrent events leads to the use of
virtual ids, which are strings.
It wasn't possible to change the message subscriptions
for recurring events,
neither for the user himself, neither for the other followers

opw-627895
2015-02-23 14:29:01 +01:00
Denis Ledoux 0200e31f7b [FIX] calendar: context can be frozen in Odoo 8.0 2015-02-20 16:53:02 +01:00
Denis Ledoux 6539104a4f [FIX] calendar: add followers to recurrent events
default_get method of mail.wizard.invite model uses
the key 'default_res_id' to retrieve the res_id of the record
to add the followers.

In the case of recurrent events, virtual ids are used, and
the conversion from virtual ids to real ids is needed.
2015-02-20 16:13:28 +01:00
Richard Mathot af94e5af6b [FIX] calendar: loading problem with some locales
When you try to load calendar_demo.xml, the loading of demo event
`calendar_event_1` fails with fr_BE locale (and probably some others).

This is due to the rendering of the mail template
`calendar_template_meeting_invitation` (which is used when you create
an event).

This template used a method `get_interval()` in calendar.py, which
does not always return Unicode strings. Furthermore, these strings
are dates and should be formatted according to user locale.

PS: Yeah, we love Python2's management of encodings and Unicode...
2015-02-17 14:41:29 +01:00
Jeremy Kersten 8ef8cf7dba [IMP] calendar: use from_string and to_string from new api to convert datetime/string 2015-02-12 11:57:01 +01:00
Jeremy Kersten 064f18e6b6 [FIX] calendar: stop to think that cron will be always on time
Fix error where if no email_from was in openerp.tool.config, notif by mail was not sent
Add optionnal param 'missing' to allow to have missing alarm.

Missing field is the date from the last time that cron had run.
Now we stop to process the next 30 minutes, but we process all alarm since the next cron.
So, an email alarm will be always in delay, but a mail will be sent !

In v8 we use ICP to save the date, but it should be changed in master, maybe we should
save the last execution time in the ir_cron model directly ?
2015-02-12 11:57:01 +01:00
Jeremy Kersten e0c17258bd [FIX] calendar: allow to force the sending of email in function _send_mail_to_attendees (even if email are himself) and use it for reminder. 2015-02-06 14:02:36 +01:00
Denis Ledoux 6c78541978 [FIX] calendar: prevent updating event with a start date greater than the end date
Setting a constraint on an old api style computed field is broken in Odoo 8.0
The constraint is checked with the old value of the computed field, not the new one
So, it was possible to update an event with a start date greater than the stop date
And once done, it was impossible to correct the mistake
2015-01-08 14:19:28 +01:00
Denis Ledoux faf45db0d2 [FIX] calendar: set duration on either stop or start date updated
Not only when both are.
2015-01-08 12:22:13 +01:00
tfossoul f3c4688715 [FIX] Calendar : virtual ID fix. Close #4465 2014-12-31 11:56:28 +01:00
Jeremy Kersten 42fbb5fd71 Revert "[IMP] calendar: Set default value for start* and stop* date/datetime. Else field.function start and stop are not setted by default while they are required."
This reverts commit b1adf3a95e.

Not so simple, 'search' don't find recurrent events with this change
2014-12-14 22:43:29 +01:00
Jeremy Kersten b1adf3a95e [IMP] calendar: Set default value for start* and stop* date/datetime. Else field.function start and stop are not setted by default while they are required. 2014-12-12 17:09:53 +01:00
Jeremy Kersten de641ccbf8 [FIX] calendar: allow to sort in tree view the starting date (start, start_date, start_datetime) (hack for V8) 2014-11-21 14:07:09 +01:00
Olivier Dony cc762004ed [FIX] calendar: support non-ascii chars in date/time format
The calendar module generates string values with
a date/time formatted according to the user
language. Those formats may contain non-ascii
characters and are read as unicode strings,
but fed to str{p,t}time, which only accepts
byte strings (in Python 2).

This would cause an exception when loading calendar
notifications for a user using e.g. Chinese with
some CJK unicode chars in the date/time format.
2014-11-20 18:16:41 +01:00
Christophe Simonis ed925892b9 [MERGE] forward port of branch saas-3 up to 2c1bcfb 2014-10-23 16:52:37 +02:00
Denis Ledoux 2c1bcfb2c9 [FIX] calendar: avoid to pass ids as string to unlink and write methods
opw-616532: if the event is associated somehow to a workflow, an assert is done to check that element of the ids list are (int, long)
2014-10-23 16:40:53 +02:00
Jeremy Kersten 24bec094c2 [IMP] hr_holiday/calendar : allow to pass no_email into context when we create a meeting to avoid to send a mail to attendees. 2014-10-03 20:43:48 +02:00
Christophe Simonis 41afeec7f1 [MERGE] forward port of branch saas-5 up to 9363bc9 2014-09-04 18:03:24 +02:00
Christophe Simonis 9363bc9182 [MERGE] forward port of branch saas-3 up to 3d80dc2 2014-09-04 17:51:42 +02:00
Stéphane Wirtel 1ff7ed2758 [IMP] Optimize the schedulers of the calendar, fetchmail and base_action_rules modules
Disable the the crons when they'd have nothing to do, re-enable them when a
task is (probably) introduced
2014-09-02 18:32:27 +02:00
Raphael Collet 97256fa1fb [IMP] models: move prefetching of records back to method _prefetch_field
The selection of records in cache for prefetching was moved to method
_read_from_database() by xmo at rev 785018cc in order to fix an access right
bug.  But this introduced an issue: to explicitly avoid prefetching, you should
use read() instead of browsing records.  We revert the change by xmo, without
reintroducing the bug (which apparently was fixed by another way).
2014-08-22 14:42:20 +02:00
Denis Ledoux ae65be2b2a [MERGE] forward port of branch saas-5 up to 0739bc4 2014-08-11 15:58:02 +02:00
Denis Ledoux 7c647ec876 [MERGE] forward port of branch saas-4 up to 0a1e4a0 2014-08-08 17:27:29 +02:00
Denis Ledoux 0a1e4a05b2 [MERGE] forward port of branch saas-3 up to 81a902a 2014-08-08 17:06:39 +02:00
Olivier Dony 4b2f2a1561 [IMP] calendar.event: _compute should be done in batch + consistent @multi attributes 2014-08-07 18:03:08 +02:00
Olivier Dony 6445ce7922 [FIX] calendar.read: do not re-compute `display_time` for virtual calendar ID if not requested 2014-08-07 18:03:08 +02:00
Olivier Dony 30ddb67299 [IMP] calendar: simplify/optimize `rrule` computed field
Avoid reading one record at a time, leading to multiple
calls to read() which is special-cased and even slower
than a normal one.
2014-08-07 18:03:08 +02:00
Jeremy Kersten 6655a020c3 [FIX] calendar/crm: Add active_id (if in model partner_id) in defaults values from partner_ids when we creates a new meeting.
Bug was that when you click on meeting button from a res_partner form (Customers in menu), the button overwrites the context to use the active partner as a default in the calendar meeting. By consequence, the context overwritte the default partner who are the creator. Now the context could be removed from action and that is in get_default for partner_ids (from model calendar_event) that we add the creator AND the active_id if from a model res_partner.
2014-08-07 13:02:59 +02:00