mirror of https://github.com/OCA/web.git
[MIG] web_calendar_slot_duration: Migration to 17.0
parent
f868b1923c
commit
ee02fc15fc
|
@ -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
|
||||
======================
|
||||
|
||||
|
|
|
@ -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"],
|
||||
}
|
||||
|
|
|
@ -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,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"
|
|
@ -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"
|
||||
|
|
|
@ -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 |
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
|
@ -1,4 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
|
@ -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
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/17.0/web_calendar_slot_duration"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_calendar_slot_duration"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module extends the functionality of backend calendars to support
|
||||
|
@ -392,18 +391,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);
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue