diff --git a/web_calendar_slot_duration/README.rst b/web_calendar_slot_duration/README.rst index 75028bd8f..acdcc8f73 100644 --- a/web_calendar_slot_duration/README.rst +++ b/web_calendar_slot_duration/README.rst @@ -43,8 +43,8 @@ Configuration This documentation is for developers. If you want to configure your calendar view's snap duration, make sure -that you action includes a context similar to this (example is the -default value): +that your window action includes a context similar to this (example is +the default value): :: @@ -53,12 +53,22 @@ default value): It can be added in actions defined on python or as ``ir.actions.act_window`` records. +|edit action settings| + +|result| + +.. |edit action settings| image:: https://raw.githubusercontent.com/OCA/web/17.0/web_calendar_slot_duration/static/description/edit_action.png +.. |result| image:: https://raw.githubusercontent.com/OCA/web/17.0/web_calendar_slot_duration/static/description/calendar_result.png + Usage ===== To use this module, you need to install some other addon that uses it, as it doesn't provide any end-user functionality. +As demo data, this module modifies the "Scheduled Actions" calendar to +have slots of 10 minutes as feature demonstration. + Known issues / Roadmap ====================== diff --git a/web_calendar_slot_duration/__manifest__.py b/web_calendar_slot_duration/__manifest__.py index dabd14f98..e8be09ae6 100644 --- a/web_calendar_slot_duration/__manifest__.py +++ b/web_calendar_slot_duration/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Calendar slot duration", "summary": "Customizable calendar slot durations", - "version": "16.0.1.0.1", + "version": "17.0.1.0.0", "development_status": "Production/Stable", "category": "Extra Tools", "website": "https://github.com/OCA/web", @@ -18,5 +18,6 @@ "web_calendar_slot_duration/static/src/js/calendar_model.esm.js", ] }, + "data": ["demo/scheduled_actions.xml"], "depends": ["web"], } diff --git a/web_calendar_slot_duration/demo/scheduled_actions.xml b/web_calendar_slot_duration/demo/scheduled_actions.xml new file mode 100644 index 000000000..1570adc25 --- /dev/null +++ b/web_calendar_slot_duration/demo/scheduled_actions.xml @@ -0,0 +1,8 @@ + + + + {'search_default_all': 1, "calendar_slot_duration": "00:10:00"} + + diff --git a/web_calendar_slot_duration/readme/CONFIGURE.md b/web_calendar_slot_duration/readme/CONFIGURE.md index 0ab98f2d8..05195bff0 100644 --- a/web_calendar_slot_duration/readme/CONFIGURE.md +++ b/web_calendar_slot_duration/readme/CONFIGURE.md @@ -1,10 +1,14 @@ This documentation is for developers. If you want to configure your calendar view's snap duration, make sure -that you action includes a context similar to this (example is the +that your window action includes a context similar to this (example is the default value): {"calendar_slot_duration": "00:30:00"} It can be added in actions defined on python or as `ir.actions.act_window` records. + +![edit action settings](../static/description/edit_action.png) + +![result](../static/description/calendar_result.png) diff --git a/web_calendar_slot_duration/readme/USAGE.md b/web_calendar_slot_duration/readme/USAGE.md index ad35d5dad..698cd24be 100644 --- a/web_calendar_slot_duration/readme/USAGE.md +++ b/web_calendar_slot_duration/readme/USAGE.md @@ -1,2 +1,4 @@ To use this module, you need to install some other addon that uses it, as it doesn't provide any end-user functionality. + +As demo data, this module modifies the "Scheduled Actions" calendar to have slots of 10 minutes as feature demonstration. \ No newline at end of file diff --git a/web_calendar_slot_duration/static/description/calendar_result.png b/web_calendar_slot_duration/static/description/calendar_result.png new file mode 100644 index 000000000..0f651aef8 Binary files /dev/null and b/web_calendar_slot_duration/static/description/calendar_result.png differ diff --git a/web_calendar_slot_duration/static/description/edit_action.png b/web_calendar_slot_duration/static/description/edit_action.png new file mode 100644 index 000000000..d2fb48a41 Binary files /dev/null and b/web_calendar_slot_duration/static/description/edit_action.png differ diff --git a/web_calendar_slot_duration/static/description/index.html b/web_calendar_slot_duration/static/description/index.html index be58b5cc4..f11fe395c 100644 --- a/web_calendar_slot_duration/static/description/index.html +++ b/web_calendar_slot_duration/static/description/index.html @@ -392,18 +392,22 @@ regarding event duration and snapping.

Configuration

This documentation is for developers.

If you want to configure your calendar view’s snap duration, make sure -that you action includes a context similar to this (example is the -default value):

+that your window action includes a context similar to this (example is +the default value):

 {"calendar_slot_duration": "00:30:00"}
 

It can be added in actions defined on python or as ir.actions.act_window records.

+

edit action settings

+

result

Usage

To use this module, you need to install some other addon that uses it, as it doesn’t provide any end-user functionality.

+

As demo data, this module modifies the “Scheduled Actions” calendar to +have slots of 10 minutes as feature demonstration.

Known issues / Roadmap

diff --git a/web_calendar_slot_duration/static/src/js/calendar_common_renderer.esm.js b/web_calendar_slot_duration/static/src/js/calendar_common_renderer.esm.js index acbff978d..e0999ec0f 100644 --- a/web_calendar_slot_duration/static/src/js/calendar_common_renderer.esm.js +++ b/web_calendar_slot_duration/static/src/js/calendar_common_renderer.esm.js @@ -5,17 +5,12 @@ import {CalendarCommonRenderer} from "@web/views/calendar/calendar_common/calendar_common_renderer"; import {patch} from "@web/core/utils/patch"; -patch( - CalendarCommonRenderer.prototype, - "WebCalendarSlotDurationCalendarCommonRenderer", - { - get options() { - const options = this._super(...arguments); - if (this.env.searchModel.context.calendar_slot_duration) { - options.slotDuration = - this.env.searchModel.context.calendar_slot_duration; - } - return options; - }, - } -); +patch(CalendarCommonRenderer.prototype, { + get options() { + const options = super.options; + if (this.env.searchModel.context.calendar_slot_duration) { + options.slotDuration = this.env.searchModel.context.calendar_slot_duration; + } + return options; + }, +}); diff --git a/web_calendar_slot_duration/static/src/js/calendar_model.esm.js b/web_calendar_slot_duration/static/src/js/calendar_model.esm.js index 7acbbbaa0..a3ae80266 100644 --- a/web_calendar_slot_duration/static/src/js/calendar_model.esm.js +++ b/web_calendar_slot_duration/static/src/js/calendar_model.esm.js @@ -6,7 +6,7 @@ import {CalendarModel} from "@web/views/calendar/calendar_model"; import {patch} from "@web/core/utils/patch"; -patch(CalendarModel.prototype, "WebCalendarSlotDurationCalendarModel", { +patch(CalendarModel.prototype, { buildRawRecord(partialRecord, options = {}) { if ( !partialRecord.end && @@ -20,6 +20,6 @@ patch(CalendarModel.prototype, "WebCalendarSlotDurationCalendarModel", { const durationFloat = hours + minutes / 60 + seconds / 3600; partialRecord.end = partialRecord.start.plus({hours: durationFloat}); } - return this._super(partialRecord, options); + return super.buildRawRecord(partialRecord, options); }, });