mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[MIG] web_calendar_slot_duration: Migration to 17.0
This commit is contained in:
@@ -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
|
||||
======================
|
||||
|
||||
|
||||
@@ -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"],
|
||||
}
|
||||
|
||||
8
web_calendar_slot_duration/demo/scheduled_actions.xml
Normal file
8
web_calendar_slot_duration/demo/scheduled_actions.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="base.ir_cron_act" model="ir.actions.act_window">
|
||||
<field
|
||||
name="context"
|
||||
>{'search_default_all': 1, "calendar_slot_duration": "00:10:00"}</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -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.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
@@ -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.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
BIN
web_calendar_slot_duration/static/description/edit_action.png
Normal file
BIN
web_calendar_slot_duration/static/description/edit_action.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -392,18 +392,22 @@ regarding event duration and snapping.</p>
|
||||
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
|
||||
<p>This documentation is for developers.</p>
|
||||
<p>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):</p>
|
||||
that your window action includes a context similar to this (example is
|
||||
the default value):</p>
|
||||
<pre class="literal-block">
|
||||
{"calendar_slot_duration": "00:30:00"}
|
||||
</pre>
|
||||
<p>It can be added in actions defined on python or as
|
||||
<tt class="docutils literal">ir.actions.act_window</tt> records.</p>
|
||||
<p><img alt="edit action settings" src="https://raw.githubusercontent.com/OCA/web/17.0/web_calendar_slot_duration/static/description/edit_action.png" /></p>
|
||||
<p><img alt="result" src="https://raw.githubusercontent.com/OCA/web/17.0/web_calendar_slot_duration/static/description/calendar_result.png" /></p>
|
||||
</div>
|
||||
<div class="section" id="usage">
|
||||
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
|
||||
<p>To use this module, you need to install some other addon that uses it,
|
||||
as it doesn’t provide any end-user functionality.</p>
|
||||
<p>As demo data, this module modifies the “Scheduled Actions” calendar to
|
||||
have slots of 10 minutes as feature demonstration.</p>
|
||||
</div>
|
||||
<div class="section" id="known-issues-roadmap">
|
||||
<h1><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h1>
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user