diff --git a/web_calendar_slot_duration/README.rst b/web_calendar_slot_duration/README.rst index 75028bd8f..69ec4e029 100644 --- a/web_calendar_slot_duration/README.rst +++ b/web_calendar_slot_duration/README.rst @@ -7,7 +7,7 @@ Calendar slot duration !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:1274b3dddbcd34bf1401a1f208b67af94f47a47121fa32b120acbc37c84a63be + !! source digest: sha256:2be0b00f67ed141f98a951795ae0ba21a2912b90c42a00ed2ce136cee2def017 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png @@ -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/i18n/it.po b/web_calendar_slot_duration/i18n/it.po index 73388557f..e69de29bb 100644 --- a/web_calendar_slot_duration/i18n/it.po +++ b/web_calendar_slot_duration/i18n/it.po @@ -1,14 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" -"Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" -"Language-Team: none\n" -"Language: it\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" diff --git a/web_calendar_slot_duration/i18n/web_calendar_slot_duration.pot b/web_calendar_slot_duration/i18n/web_calendar_slot_duration.pot index 78d58d53f..716a0702d 100644 --- a/web_calendar_slot_duration/i18n/web_calendar_slot_duration.pot +++ b/web_calendar_slot_duration/i18n/web_calendar_slot_duration.pot @@ -3,7 +3,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" +"Project-Id-Version: Odoo Server 17.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" 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..52f7624a9 100644 --- a/web_calendar_slot_duration/static/description/index.html +++ b/web_calendar_slot_duration/static/description/index.html @@ -1,4 +1,3 @@ - @@ -367,7 +366,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:1274b3dddbcd34bf1401a1f208b67af94f47a47121fa32b120acbc37c84a63be +!! source digest: sha256:2be0b00f67ed141f98a951795ae0ba21a2912b90c42a00ed2ce136cee2def017 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Production/Stable License: LGPL-3 OCA/web Translate me on Weblate Try me on Runboat

This module extends the functionality of backend calendars to support @@ -392,18 +391,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); }, });