mirror of https://github.com/OCA/web.git
parent
243afcdf36
commit
b35f3326ea
|
@ -2,10 +2,13 @@
|
|||
Calendar slot duration
|
||||
======================
|
||||
|
||||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
..
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:b6cdb18144c44833ba86f19e14860a819285cd5d4ffd937f9633f6fbdfbeb93d
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
|
||||
:target: https://odoo-community.org/page/development-status
|
||||
|
@ -14,16 +17,16 @@ Calendar slot duration
|
|||
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
|
||||
:alt: License: LGPL-3
|
||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
|
||||
:target: https://github.com/OCA/web/tree/15.0/web_calendar_slot_duration
|
||||
:target: https://github.com/OCA/web/tree/16.0/web_calendar_slot_duration
|
||||
:alt: OCA/web
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_calendar_slot_duration
|
||||
:target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_calendar_slot_duration
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||
:target: https://runbot.odoo-community.org/runbot/162/15.0
|
||||
:alt: Try me on Runbot
|
||||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
||||
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.0
|
||||
:alt: Try me on Runboat
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
This module extends the functionality of backend calendars to support custom
|
||||
slot durations and to allow you to provide more specific UX regarding event
|
||||
|
@ -63,8 +66,8 @@ Bug Tracker
|
|||
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_calendar_slot_duration%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_calendar_slot_duration%0Aversion:%2016.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.
|
||||
|
||||
|
@ -76,6 +79,14 @@ Authors
|
|||
|
||||
* Tecnativa
|
||||
|
||||
Contributors
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||
|
||||
* Jairo Llopis
|
||||
* Stefan Ungureanu
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
|
||||
|
@ -97,6 +108,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
|||
|
||||
|maintainer-Yajo|
|
||||
|
||||
This module is part of the `OCA/web <https://github.com/OCA/web/tree/15.0/web_calendar_slot_duration>`_ project on GitHub.
|
||||
This module is part of the `OCA/web <https://github.com/OCA/web/tree/16.0/web_calendar_slot_duration>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
{
|
||||
"name": "Calendar slot duration",
|
||||
"summary": "Customizable calendar slot durations",
|
||||
"version": "15.0.1.0.0",
|
||||
"version": "16.0.1.0.0",
|
||||
"development_status": "Production/Stable",
|
||||
"category": "Extra Tools",
|
||||
"website": "https://github.com/OCA/web",
|
||||
|
@ -14,7 +14,8 @@
|
|||
"installable": True,
|
||||
"assets": {
|
||||
"web.assets_backend": [
|
||||
"web_calendar_slot_duration/static/src/js/calendar_model.esm.js"
|
||||
"web_calendar_slot_duration/static/src/js/calendar_common_renderer.esm.js",
|
||||
"web_calendar_slot_duration/static/src/js/calendar_model.esm.js",
|
||||
]
|
||||
},
|
||||
"depends": ["web"],
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||
|
||||
* Jairo Llopis
|
||||
* Stefan Ungureanu
|
|
@ -3,7 +3,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
|
||||
<title>Calendar slot duration</title>
|
||||
<style type="text/css">
|
||||
|
||||
|
@ -366,8 +366,10 @@ ul.auto-toc {
|
|||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:b6cdb18144c44833ba86f19e14860a819285cd5d4ffd937f9633f6fbdfbeb93d
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" 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" 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" href="https://github.com/OCA/web/tree/15.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" href="https://translation.odoo-community.org/projects/web-15-0/web-15-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" href="https://runbot.odoo-community.org/runbot/162/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p><a class="reference external" 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" 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" href="https://github.com/OCA/web/tree/16.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" href="https://translation.odoo-community.org/projects/web-16-0/web-16-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" href="https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.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 custom
|
||||
slot durations and to allow you to provide more specific UX regarding event
|
||||
duration and snapping.</p>
|
||||
|
@ -380,7 +382,8 @@ duration and snapping.</p>
|
|||
<li><a class="reference internal" href="#bug-tracker" id="id4">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="id5">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="id6">Authors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="id7">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="id8">Maintainers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -411,8 +414,8 @@ doesn’t provide any end-user functionality.</p>
|
|||
<h1><a class="toc-backref" href="#id4">Bug Tracker</a></h1>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_calendar_slot_duration%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_calendar_slot_duration%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
|
@ -423,8 +426,18 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
|||
<li>Tecnativa</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="contributors">
|
||||
<h2><a class="toc-backref" href="#id7">Contributors</a></h2>
|
||||
<ul class="simple">
|
||||
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
|
||||
<li>Jairo Llopis</li>
|
||||
<li>Stefan Ungureanu</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
|
||||
<h2><a class="toc-backref" href="#id8">Maintainers</a></h2>
|
||||
<p>This module is maintained by the OCA.</p>
|
||||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
|
@ -432,7 +445,7 @@ mission is to support the collaborative development of Odoo features and
|
|||
promote its widespread use.</p>
|
||||
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
|
||||
<p><a class="reference external" href="https://github.com/Yajo"><img alt="Yajo" src="https://github.com/Yajo.png?size=40px" /></a></p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/15.0/web_calendar_slot_duration">OCA/web</a> project on GitHub.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/16.0/web_calendar_slot_duration">OCA/web</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
/** @odoo-module **/
|
||||
/* Copyright 2023 Tecnativa - Stefan Ungureanu
|
||||
* License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). */
|
||||
|
||||
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;
|
||||
},
|
||||
}
|
||||
);
|
|
@ -1,20 +1,22 @@
|
|||
/* Copyright 2021 Tecnativa - Jairo Llopis
|
||||
/** @odoo-module **/
|
||||
/* Copyright 2023 Tecnativa - Stefan Ungureanu
|
||||
|
||||
* License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). */
|
||||
|
||||
odoo.define("web_calendar_slot_duration.CalendarModel", function (require) {
|
||||
var CalendarModel = require("web.CalendarModel");
|
||||
import {CalendarModel} from "@web/views/calendar/calendar_model";
|
||||
import {patch} from "@web/core/utils/patch";
|
||||
|
||||
CalendarModel.include({
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
_getFullCalendarOptions: function () {
|
||||
var result = this._super.call(this, arguments);
|
||||
result.slotDuration =
|
||||
this.data.context.calendar_slot_duration ||
|
||||
result.slotDuration ||
|
||||
"00:30:00";
|
||||
return result;
|
||||
},
|
||||
});
|
||||
patch(CalendarModel.prototype, "WebCalendarSlotDurationCalendarModel", {
|
||||
buildRawRecord(partialRecord, options = {}) {
|
||||
if (
|
||||
this.env.searchModel.context.calendar_slot_duration &&
|
||||
partialRecord.isAllDay != true
|
||||
) {
|
||||
const slot_duration = this.env.searchModel.context.calendar_slot_duration;
|
||||
const [hours, minutes, seconds] = slot_duration.match(/(\d+):(\d+):(\d+)/);
|
||||
const durationFloat = hours + minutes / 60 + seconds / 3600;
|
||||
partialRecord.end = partialRecord.start.plus({hours: durationFloat});
|
||||
}
|
||||
return this._super(partialRecord, options);
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue