mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
[IMP] base_ical: Allow advanced snippets. Use apikeys with scope.
This commit is contained in:
@@ -2,13 +2,10 @@
|
||||
Readonly publishing of calendars
|
||||
================================
|
||||
|
||||
..
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:f98a0b075e11b8bf4075af16bbe8ba8b249d03f4b675874d232c68a897235579
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
|
||||
:target: https://odoo-community.org/page/development-status
|
||||
@@ -23,10 +20,10 @@ Readonly publishing of calendars
|
||||
:target: https://translation.odoo-community.org/projects/server-backend-15-0/server-backend-15-0-base_ical
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
||||
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-backend&target_branch=15.0
|
||||
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/server-backend&target_branch=15.0
|
||||
:alt: Try me on Runboat
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
This module allows administrators to configure iCalendars based on an arbitrary selection on arbitrary models.
|
||||
|
||||
@@ -50,13 +47,45 @@ Configuration
|
||||
To configure this module, you need to:
|
||||
|
||||
#. Go to Settings/Technical/iCalendars
|
||||
#. Create a calendar, fill in the model you want to expose and possibly a domain to restrict records. You can use the ``user`` variable to restrict things relative to the user using the calendar
|
||||
#. A few iCalendar-fields have defaults that should work for any model, you'll have to fill in expressions manually though for the start and end date of the records.
|
||||
#. Create a iCalendar, fill in the model you want to expose and possibly a domain to restrict records. You can use the ``user`` variable to restrict things relative to the user using the iCalendar
|
||||
#. A iCalendar is only available to the allowed users. Use the `Allow automatically` to make the iCalendar available to all users
|
||||
#. See the examples below for a start
|
||||
|
||||
For example, for model ``calendar.event``, you'd fill in ``record.allday and record.start_date or record.start`` as `DTSTART` and ``record.allday and record.stop_date or record.stop`` as `DTEND`.
|
||||
Examples
|
||||
~~~~~~~~
|
||||
|
||||
For model ``hr.leave``, you'd write ``(record.request_unit_half or record.request_unit_hours) and record.date_from or record.date_from.date()`` for `DTSTART` and ``(record.request_unit_half or record.request_unit_hours) and record.date_to or (record.date_to.date() + timedelta(days=1))`` for `DTEND` - this is a bit more complex because of the way Odoo handles the begin and end times of leaves, and you'll want the extra day as most clients interpret the end date as non-inclusive.
|
||||
#. Existing calendars are available for users in the tab `Calendars` of their profile form, where they can enable them to obtain a link they can paste into whatever client they are going to use
|
||||
Simple example, for model ``calendar.event``, you'd fill in ``record.allday and record.start_date or record.start`` as `DTSTART` and ``record.allday and record.stop_date or record.stop`` as `DTEND`.
|
||||
|
||||
Advanced example, for model ``calendar.event``, you'd use ``calendar = record._get_ics_file()`` in the code.
|
||||
|
||||
Advanced example, for model ``hr.leave``, you can use the following code and ``[("employee_id.user_id", "=", user.id)]`` in the `domain` to export the own time offs. This is a bit more complex because of the way Odoo handles the begin and end times of leaves, and you'll want the extra day as most clients interpret the end date as non-inclusive.:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
confirmed = ("validate", "validate1")
|
||||
if record.request_unit_half or record.request_unit_hours:
|
||||
event = {
|
||||
"dtstart": event["dtstart"].date(),
|
||||
"dtend": event["dtend"].date() + timedelta(days=1),
|
||||
}
|
||||
else:
|
||||
event = {
|
||||
"dtstart": record.date_from,
|
||||
"dtend": record.date_to,
|
||||
}
|
||||
|
||||
event["summary"] = record.name
|
||||
event["status"] = "CONFIRMED" if record.state in confirmed else "TENTATIVE"
|
||||
|
||||
Advanced example, for model ``mail.activity``, you can use the following code and ``[("user_id", "=", user.id)]`` and `domain` to export all user activities.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
todo = {
|
||||
"summary": record.display_name,
|
||||
"due": record.date_deadline,
|
||||
"description": html2plaintext(record.note) if record.note else ""
|
||||
}
|
||||
|
||||
Usage
|
||||
=====
|
||||
@@ -78,7 +107,7 @@ Bug Tracker
|
||||
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-backend/issues>`_.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/OCA/server-backend/issues/new?body=module:%20base_ical%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
@@ -95,14 +124,7 @@ Contributors
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* Holger Brunn <mail@hunki-enterprises.com> (https://hunki-enterprises.com)
|
||||
|
||||
Other credits
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
The development of this module has been financially supported by:
|
||||
|
||||
* Company 1 name
|
||||
* Company 2 name
|
||||
* Florian Kantelberg <florian.kantelberg@initos.com> (https://www.initos.com)
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
|
||||
Reference in New Issue
Block a user