Search 1.9 billion lines of Odoo code on GitHub

web_search_date_range

Author: Numigi
License: LGPL-3
Branch: 14.0
Repository: Numigi/odoo-web-addons
Dependencies: web
Languages: JavaScript (126, 16.8%), PO File (78, 10.4%), Python (288, 38.4%), XML (198, 26.4%), and reStructuredText (60, 8.0%)
Other branches: 11.0, 11.0-website_sale_sanitized, 12.0, 12.0-web_list_column_text_align, TA#47984, TA#48575, and TA#48575-1

<h1 class="title">Web Search Date Range</h1> <div class="contents topic" id="table-of-contents"> <p class="topic-title">Table of Contents</p> <ul class="simple"> <li><a class="reference internal" href="#context" id="id1">Context</a></li> <li><a class="reference internal" href="#overview" id="id2">Overview</a></li> <li><a class="reference internal" href="#configuration" id="id3">Configuration</a><ul> <li><a class="reference internal" href="#date-filters" id="id4">Date Filters</a></li> <li><a class="reference internal" href="#date-ranges" id="id5">Date Ranges</a></li> </ul> </li> <li><a class="reference internal" href="#weekly-date-ranges" id="id6">Weekly Date Ranges</a></li> <li><a class="reference internal" href="#contributors" id="id7">Contributors</a></li> </ul> </div> <a name="context"></a> <h2><a class="toc-backref" href="#id1">Context</a></h2> <p>Vanilla Odoo comes with a predefined set of date range filters.</p> <img alt="static/description/vanilla_odoo_filters.png" src="static/description/vanilla_odoo_filters.png" /> <p>There are multiple issues with these filters:</p> <ul class="simple"> <li>They can not be customized (at least without extra javascript code).</li> <li>They are based on static dates, which is not suitable for dashboards (you don't want to update your dashboard every month).</li> <li>Quarters are only relevant for a company with a fiscal exercise from January to December.</li> </ul> <a name="overview"></a> <h2><a class="toc-backref" href="#id2">Overview</a></h2> <p>This module allows to easily add contextual date range filters.</p> <p>Contextual means that the filter does not need to be updated. It always filters records based on the current date.</p> <p>You may add one of these filters to your favorites or your dashboard and it will not need to be refreshed.</p> <img alt="static/description/sale_order_list.png" src="static/description/sale_order_list.png" /> <a name="configuration"></a> <h2><a class="toc-backref" href="#id3">Configuration</a></h2> <a name="date-filters"></a> <h3><a class="toc-backref" href="#id4">Date Filters</a></h3> <p>To edit the list of filters that appear in the search view of a model:</p> <ul class="simple"> <li>Go to: Settings / Technical / User Interface / Date Filters</li> </ul> <img alt="static/description/date_filters.png" src="static/description/date_filters.png" /> <p>After editing the filters, you need to refresh your page for the changes to be applied.</p> <a name="date-ranges"></a> <h3><a class="toc-backref" href="#id5">Date Ranges</a></h3> <p>The module comes with the following predefined date ranges:</p> <ul class="simple"> <li>Before Today</li> <li>Today</li> <li>Next Fifteen Days</li> <li>Previous Week</li> <li>Current Week</li> <li>Next Week</li> <li>Previous Month</li> <li>Current Month</li> <li>Next Month</li> <li>Previous Year</li> <li>Current Year</li> <li>Next Year</li> </ul> <p>To add a custom range type:</p> <ul class="simple"> <li>Go to: Settings / Technical / User Interface / Date Ranges</li> </ul> <img alt="static/description/date_range_list.png" src="static/description/date_range_list.png" /> <ul class="simple"> <li>Click on <cite>Create</cite>.</li> </ul> <img alt="static/description/date_range_form.png" src="static/description/date_range_form.png" /> <ul class="simple"> <li>Enter a label for your range type.</li> <li>Enter a domain filter for your new range type.</li> </ul> <img alt="static/description/date_range_with_domain.png" src="static/description/date_range_with_domain.png" /> <p>The following variables can be used inside the domain:</p> <ul class="simple"> <li>field: the technical name of the field being queried</li> <li>today: the current date in the timezone of the user</li> <li>datetime: the datetime.datetime class</li> <li>relativedelta: the dateutil.relativedelta.relativedelta class</li> <li>MO, TU, WE, TH, FR, SA, SU: dateutil.relativedelta.weekdays</li> </ul> <p>See the library <a class="reference external" href="https://dateutil.readthedocs.io/en/stable/relativedelta.html">relativedelta</a> for more info.</p> <a name="weekly-date-ranges"></a> <h2><a class="toc-backref" href="#id6">Weekly Date Ranges</a></h2> <p>Weekly date ranges are implemented from monday to sunday.</p> <p>If you prefer from sunday to saturday:</p> <ul class="simple"> <li>Go to: Settings / Technical / User Interface / Date Range Types.</li> <li><dl class="first docutils"> <dt>For each weekly range type:</dt> <dd><ol class="first last arabic"> <li>Adapt the domain.</li> <li>Check the <cite>No Update</cite> checkbox.</li> </ol> </dd> </dl> </li> </ul> <img alt="static/description/weekly_date_range.png" src="static/description/weekly_date_range.png" /> <a name="contributors"></a> <h2><a class="toc-backref" href="#id7">Contributors</a></h2> <ul class="simple"> <li>Numigi (tm) and all its contributors (<a class="reference external" href="https://bit.ly/numigiens">https://bit.ly/numigiens</a>)</li> </ul>