Search 1.9 billion lines of Odoo code on GitHub

base_time_window

Author: ACSONE SA/NV, Camptocamp, Odoo Community Association (OCA)
License: AGPL-3
Branch: 16.0
Repository: brain-tec/server-tools
Dependencies: base
Languages: HTML (387, 52.4%), PO File (71, 9.6%), Python (159, 21.5%), XML (36, 4.9%), and reStructuredText (86, 11.6%)
Other branches: 13.0, 13.0-ocabot-merge-pr-1764-by-dreispt-bump-nobump, 13.0-ocabot-merge-pr-1776-by-moylop260-bump-nobump, 13.0-ocabot-merge-pr-1837-by-simahawk-bump-nobump, 13.0-ocabot-merge-pr-1887-by-dreispt-bump-nobump, 13.0-ocabot-merge-pr-2200-by-LoisRForgeFlow-bump-nobump, 14.0, 14.0-ocabot-merge-pr-2022-by-dreispt-bump-nobump, 14.0-ocabot-merge-pr-2073-by-dreispt-bump-nobump, 14.0-ocabot-merge-pr-2073-by-pedrobaeza-bump-nobump, 14.0-ocabot-merge-pr-2083-by-dreispt-bump-nobump, 14.0-ocabot-merge-pr-2179-by-moylop260-bump-nobump, 14.0-ocabot-merge-pr-2189-by-lmignon-bump-minor, 14.0-ocabot-merge-pr-2190-by-pedrobaeza-bump-patch, 14.0-ocabot-merge-pr-2198-by-pedrobaeza-bump-minor, 14.0-ocabot-merge-pr-2198-by-sebalix-bump-minor, 14.0-ocabot-merge-pr-2451-by-nimarosa-bump-patch, 14.0-ocabot-update-dotfiles, 15.0, 15.0-ocabot-update-dotfiles, 15.0-poc-spellcheck, 15.0.project_MI_465, and 15.0.project_SA_650
Other repositories: 001101/server-tools, AITIC/server-tools, Albin-John/server-tools, Artielkami/server-tools, Callino/server-tools, Change2improve/server-tools, Comunitea/server-tools, Digital5-Odoo/server-tools, Dobtor-OCA/server-tools, DucTruongKomit/server-tools, DulingLai/server-tools, ERPLibre/server-tools, FernandoRomera/server-tools, ForgeFlow/server-tools, Gabinete-Digital/server-tools, Ingeos/server-tools, Intesco2-0/server-tools, Jarsa/server-tools, JuaniFreedoo/server-tools, KonaERP/server-tools, LevelPrime/server-tools, LourenzoH/server-tools, NL66278/server-tools, OCA-MUK/server-tools, OCA/server-tools, OdooIndonesia/server-tools, Othniel1796/server-tools, QubiQ/server-tools, Rad0van/server-tools, SanteLibre/server-tools, ScopeaFrance/server-tools, SequarSrl/server-tools, SeuMarco/server-tools, SimoneVagile/server-tools, StefanRijnhart/server-tools, Syci-Consulting/server-tools, TRESCLOUD/server-tools, Tecnativa/server-tools, TimLai125/server-tools, UnknownInfo/server-tools, Vauxoo/server-tools, YannickB/server-tools, YogeshMahera-SerpentCS/server-tools, acsone/server-tools, adhoc-dev/server-tools, ajayjaviya/server-tools, akretion/server-tools, albertvimlet/server-tools, alfadil/server-tools, anhvu-sg/server-tools, ansinaesmejor/server-tools, antilhue/server-tools, aurestic/server-tools, avoinsystems/server-tools, blooparksystems/server-tools, bmya/server-tools, camptocamp/server-tools, captivea-dcr/server-tools, coopiteasy/server-tools, dalal-intellisoft/server-tools, ddico/server-tools, dennybiasiolli/server-tools, ecosoft-odoo/server-tools, emagdalenaC2i/server-tools, eversatis/server-tools, ewac-nl/server-tools, focusate/oca-server-tools, gab-net/server-tools, gitguohao/server-tools, grindtildeath/server-tools, gurneyalex/server-tools, hbrunn/server-tools, hibou-io/oca-server-tools, i-vyshnevska/server-tools, ideaspositivas-group/server-tools, igallart/server-tools, initOS/server-tools, invitu/server-tools, jaballate/server-tools, kait-avalah/server-tools, kittiu/server-tools, kmee/server-tools, legalsylvain/server-tools, lideritjnma/server-tools, lonelyleaves/server-tools, modoolar/server-tools, newtratip/server-tools, nilshamerlinck/server-tools, ntsirintanis/server-tools, nuobit/server-tools, omalbastin/server-tools, petrus-v/server-tools, praxigento/oca-server-tools, raizs/server-tools, rdeheele/server-tools, robertsvx27/server-tools, rsullivan2704/server-tools, rudisulistyo/server-tools, sanube/server-tools, sebalix/server-tools, simahawk/server-tools, sodexis/server-tools, solvosci/server-tools, sunflowerit/server-tools, sunshineLhj/server-tools, sysprocesarcastro/server-tools, tafaRU/server-tools, tarteo/server-tools, tegin/server-tools, tonygalmiche/server-tools, trevi-software/server-tools, trobz/server-tools, unitek-solusi/OCA-server-tools, ursais/server-tools, ventor-tech/server-tools, versada/server-tools, victoralmau/server-tools, xcgd/server-tools, ygdmxy/server-tools, ypapouin/server-tools, yuzhengxing/server-tools, zarumaru/server-tools, and zhaohuaw/server-tools

<h1 class="title">Base Time Window</h1> <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/16.0/base_time_window"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-base_time_window"><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://runbot.odoo-community.org/runbot/149/16.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p>This module provides base classes and models to manage time windows through <cite>time.window.mixin</cite>.</p> <p><strong>Table of contents</strong></p> <div class="contents local topic" id="contents"> <ul class="simple"> <li><a class="reference internal" href="#usage" id="id1">Usage</a></li> <li><a class="reference internal" href="#known-issues-roadmap" id="id2">Known issues / Roadmap</a></li> <li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li> <li><a class="reference internal" href="#credits" id="id4">Credits</a><ul> <li><a class="reference internal" href="#authors" id="id5">Authors</a></li> <li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li> <li><a class="reference internal" href="#other-credits" id="id7">Other credits</a></li> <li><a class="reference internal" href="#maintainers" id="id8">Maintainers</a></li> </ul> </li> </ul> </div> <a name="usage"></a> <h2><a class="toc-backref" href="#id1">Usage</a></h2> <p>Example implementation for the mixin can be found in module <cite>test_base_time_window</cite>.</p> <p>As a time window will always be linked to a related model thourgh a M2o relation, when defining the new model inheriting the mixin, one should pay attention to the following points in order to have the overlapping check work properly:</p> <ul class="simple"> <li>Define class property <cite>_overlap_check_field</cite>: This must state the M2o field to use for the to check of overlapping time window records linked to a specific record of the related model.</li> <li>Add the M2o field to the related model in the <cite>api.constrains</cite>:</li> </ul> <p>For example:</p> <pre> <code lang="python">class PartnerTimeWindow(models.Model): _name = 'partner.time.window' _inherit = 'time.window.mixin' partner_id = fields.Many2one( res.partner', required=True, index=True, ondelete='cascade' ) _overlap_check_field = 'partner_id' &#64;api.constrains('partner_id') def check_window_no_overlaps(self): return super().check_window_no_overlaps()</code> </pre> <a name="known-issues-roadmap"></a> <h2><a class="toc-backref" href="#id2">Known issues / Roadmap</a></h2> <ul> <li><p class="first">Storing times using <cite>float_time</cite> widget requires extra processing to ensure computations are done in the right timezone, because the value is not stored as UTC in the database, and must therefore be related to a <cite>tz</cite> field.</p> <p><cite>float_time</cite> in this sense should only be used for durations and not for a &quot;point in time&quot; as this is always needs a Date for a timezone conversion to be done properly. (Because a conversion from UTC to e.g. Europe/Brussels won't give the same result in winter or summer because of Daylight Saving Time).</p> <p>Therefore the right move would be to use a <cite>resource.calendar</cite> to define time windows using Datetime with recurrences.</p> </li> </ul> <a name="bug-tracker"></a> <h2><a class="toc-backref" href="#id3">Bug Tracker</a></h2> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/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/server-tools/issues/new?body=module:%20base_time_window%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> <a name="credits"></a> <h2><a class="toc-backref" href="#id4">Credits</a></h2> <a name="authors"></a> <h3><a class="toc-backref" href="#id5">Authors</a></h3> <ul class="simple"> <li>ACSONE SA/NV</li> <li>Camptocamp</li> </ul> <a name="contributors"></a> <h3><a class="toc-backref" href="#id6">Contributors</a></h3> <ul class="simple"> <li>Laurent Mignon &lt;<a class="reference external" href="mailto:laurent.mignon&#64;acsone.eu">laurent.mignon&#64;acsone.eu</a>&gt;</li> <li>Akim Juillerat &lt;<a class="reference external" href="mailto:akim.juillerat&#64;camptocamp.com">akim.juillerat&#64;camptocamp.com</a>&gt;</li> </ul> <p>Trobz</p> <ul class="simple"> <li>Dung Tran &lt;<a class="reference external" href="mailto:dungtd&#64;trobz.com">dungtd&#64;trobz.com</a>&gt;</li> </ul> <a name="other-credits"></a> <h3><a class="toc-backref" href="#id7">Other credits</a></h3> <p>The development of this module has been financially supported by:</p> <ul class="simple"> <li>Camptocamp</li> </ul> <a name="maintainers"></a> <h3><a class="toc-backref" href="#id8">Maintainers</a></h3> <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 mission is to support the collaborative development of Odoo features and promote its widespread use.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/16.0/base_time_window">OCA/server-tools</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>