Skip to content

Commit

Permalink
TA#66767 [IMP] web_search_date_range : module overall quality
Browse files Browse the repository at this point in the history
TA#66767 [IMP] web_search_date_range : module overall quality
  • Loading branch information
lanto-razafindrabe committed Sep 23, 2024
1 parent 73ff0a6 commit fb6fc55
Show file tree
Hide file tree
Showing 22 changed files with 49 additions and 49 deletions.
3 changes: 2 additions & 1 deletion web_search_date_range/README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
=====================
Web Search Date Range
=====================

Expand All @@ -24,7 +25,7 @@ It always filters records based on the current date.

You may add one of these filters to your favorites or your dashboard and it will not need to be refreshed.

.. image:: static/description/res_partner_list.png
.. image:: static/description/quotations_list.png

Configuration
-------------
Expand Down
2 changes: 1 addition & 1 deletion web_search_date_range/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens)
# Copyright 2023-today Numigi and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import models
7 changes: 3 additions & 4 deletions web_search_date_range/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens)
# Copyright 2023-today Numigi and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).


{

Check warning on line 4 in web_search_date_range/__manifest__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

web_search_date_range/__manifest__.py#L4

Statement seems to have no effect
"name": "Web Search Date Range",
"version": "16.0.1.0.1",
"version": "16.0.1.0.0",
"author": "Numigi",
"maintainer": "Numigi",
"website": "https://bit.ly/numigi-com",
Expand All @@ -15,10 +14,10 @@
"web",
],
"data": [
"security/ir.model.access.csv",
"data/search_date_range.xml",
"views/search_date_range_views.xml",
"views/search_date_range_filter_views.xml",
"security/ir.model.access.csv",
],
"assets": {
"web.assets_backend": [
Expand Down
26 changes: 13 additions & 13 deletions web_search_date_range/data/search_date_range.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<field name="domain">[
(field, '&lt;', today.strftime('%Y-%m-%d')),
]</field>
<field name="sequence" eval="-1"/>
<field name="sequence" eval="-1" />
</record>

<record id="range_today" model="search.date.range">
Expand All @@ -16,7 +16,7 @@
(field, '&gt;=', today.strftime('%Y-%m-%d')),
(field, '&lt;', (today + relativedelta(days=1)).strftime('%Y-%m-%d')),
]</field>
<field name="sequence" eval="1"/>
<field name="sequence" eval="1" />
</record>

<record id="range_next_fifteen_days" model="search.date.range">
Expand All @@ -26,7 +26,7 @@
(field, '&gt;=', today.strftime('%Y-%m-%d')),
(field, '&lt;', (today + relativedelta(days=15)).strftime('%Y-%m-%d')),
]</field>
<field name="sequence" eval="2"/>
<field name="sequence" eval="2" />
</record>

<!-- Week ranges are from Monday to Sunday -->
Expand All @@ -37,7 +37,7 @@
(field, '&gt;=', (today + relativedelta(days=-today.weekday() - 7)).strftime('%Y-%m-%d')),
(field, '&lt;', (today + relativedelta(days=-today.weekday())).strftime('%Y-%m-%d')),
]</field>
<field name="sequence" eval="3"/>
<field name="sequence" eval="3" />
</record>

<record id="range_current_week" model="search.date.range">
Expand All @@ -47,7 +47,7 @@
(field, '&gt;=', (today + relativedelta(days=-today.weekday())).strftime('%Y-%m-%d')),
(field, '&lt;', (today + relativedelta(days=-today.weekday() + 7)).strftime('%Y-%m-%d')),
]</field>
<field name="sequence" eval="4"/>
<field name="sequence" eval="4" />
</record>

<record id="range_next_week" model="search.date.range">
Expand All @@ -57,7 +57,7 @@
(field, '&gt;=', (today + relativedelta(days=-today.weekday() + 7)).strftime('%Y-%m-%d')),
(field, '&lt;', (today + relativedelta(days=-today.weekday() + 14)).strftime('%Y-%m-%d')),
]</field>
<field name="sequence" eval="5"/>
<field name="sequence" eval="5" />
</record>

<record id="range_previous_month" model="search.date.range">
Expand All @@ -67,7 +67,7 @@
(field, '&gt;=', (today - relativedelta(days=today.day - 1) + relativedelta(months=-1)).strftime('%Y-%m-%d')),
(field, '&lt;', (today - relativedelta(days=today.day - 1)).strftime('%Y-%m-%d')),
]</field>
<field name="sequence" eval="6"/>
<field name="sequence" eval="6" />
</record>

<record id="range_current_month" model="search.date.range">
Expand All @@ -77,7 +77,7 @@
(field, '&gt;=', (today - relativedelta(days=today.day - 1)).strftime('%Y-%m-%d')),
(field, '&lt;', (today - relativedelta(days=today.day - 1) + relativedelta(months=1)).strftime('%Y-%m-%d')),
]</field>
<field name="sequence" eval="7"/>
<field name="sequence" eval="7" />
</record>

<record id="range_next_month" model="search.date.range">
Expand All @@ -87,7 +87,7 @@
(field, '&gt;=', (today - relativedelta(days=today.day - 1) + relativedelta(months=1)).strftime('%Y-%m-%d')),
(field, '&lt;', (today - relativedelta(days=today.day - 1) + relativedelta(months=2)).strftime('%Y-%m-%d')),
]</field>
<field name="sequence" eval="8"/>
<field name="sequence" eval="8" />
</record>

<record id="range_previous_year" model="search.date.range">
Expand All @@ -97,7 +97,7 @@
(field, '&gt;=', datetime(today.year - 1, 1, 1).strftime('%Y-%m-%d')),
(field, '&lt;', datetime(today.year, 1, 1).strftime('%Y-%m-%d')),
]</field>
<field name="sequence" eval="9"/>
<field name="sequence" eval="9" />
</record>

<record id="range_current_year" model="search.date.range">
Expand All @@ -107,7 +107,7 @@
(field, '&gt;=', datetime(today.year, 1, 1).strftime('%Y-%m-%d')),
(field, '&lt;', datetime(today.year + 1, 1, 1).strftime('%Y-%m-%d')),
]</field>
<field name="sequence" eval="10"/>
<field name="sequence" eval="10" />
</record>

<record id="range_next_year" model="search.date.range">
Expand All @@ -117,7 +117,7 @@
(field, '&gt;=', datetime(today.year + 1, 1, 1).strftime('%Y-%m-%d')),
(field, '&lt;', datetime(today.year + 2, 1, 1).strftime('%Y-%m-%d')),
]</field>
<field name="sequence" eval="11"/>
<field name="sequence" eval="11" />
</record>

</odoo>
</odoo>
2 changes: 1 addition & 1 deletion web_search_date_range/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,4 @@ msgstr "Aujourd'hui"
#. module: web_search_date_range
#: model:ir.model.fields,field_description:web_search_date_range.field_search_date_range__xml_id
msgid "XML ID"
msgstr "XML ID"
msgstr "XML ID"
2 changes: 1 addition & 1 deletion web_search_date_range/models/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# © 2024 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# Copyright 2023-today Numigi and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import api, models
Expand Down
2 changes: 1 addition & 1 deletion web_search_date_range/models/search_date_range_filter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# © 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# Copyright 2023-today Numigi and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import api, fields, models
Expand Down
2 changes: 1 addition & 1 deletion web_search_date_range/models/web_search_date_range.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# © 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# Copyright 2023-today Numigi and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from datetime import datetime
Expand Down
2 changes: 1 addition & 1 deletion web_search_date_range/security/ir.model.access.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_search_date_range,access_search_date_range,model_search_date_range,,1,0,0,0
access_search_date_range_filter,access_search_date_range_filter,model_search_date_range_filter,,1,0,0,0
access_search_date_range_admin,access_search_date_range_admin,model_search_date_range,base.group_system,1,1,1,1
access_search_date_range_filter_admin,access_search_date_range_filter_admin,model_search_date_range_filter,base.group_system,1,1,1,1
access_search_date_range_filter_admin,access_search_date_range_filter_admin,model_search_date_range_filter,base.group_system,1,1,1,1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web_search_date_range/static/description/date_range_form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web_search_date_range/static/description/date_range_list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web_search_date_range/static/description/demo_date_range.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion web_search_date_range/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# © 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# Copyright 2023-today Numigi and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import test_search_date_range
Expand Down
2 changes: 1 addition & 1 deletion web_search_date_range/tests/test_res_partner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# © 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# Copyright 2023-today Numigi and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from dateutil.relativedelta import relativedelta
Expand Down
2 changes: 1 addition & 1 deletion web_search_date_range/tests/test_search_date_range.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# © 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# Copyright 2023-today Numigi and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from ddt import data, ddt
Expand Down
22 changes: 11 additions & 11 deletions web_search_date_range/views/search_date_range_filter_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<field name="model">search.date.range.filter</field>
<field name="arch" type="xml">
<tree string="Date Filters" editable="top">
<field name="model_id" options="{'no_create': 1}"/>
<field name="field_id" options="{'no_create': 1}"/>
<field name="range_ids" options="{'no_create': 1}" widget="many2many_tags"/>
<field name="model_id" options="{'no_create': 1}" />
<field name="field_id" options="{'no_create': 1}" />
<field name="range_ids" options="{'no_create': 1}" widget="many2many_tags" />
</tree>
</field>
</record>
Expand All @@ -18,12 +18,12 @@
<field name="model">search.date.range.filter</field>
<field name="arch" type="xml">
<search string="Date Filters">
<field name="model_id"/>
<field name="field_id"/>
<field name="range_ids"/>
<field name="model_id" />
<field name="field_id" />
<field name="range_ids" />
<group expand="0" string="Group By">
<filter name="group_by_model_id" string="Model" context="{'group_by': 'model_id'}"/>
<filter name="group_by_field_id" string="Field" context="{'group_by': 'field_id'}"/>
<filter name="group_by_model_id" string="Model" context="{'group_by': 'model_id'}" />
<filter name="group_by_field_id" string="Field" context="{'group_by': 'field_id'}" />
</group>
</search>
</field>
Expand All @@ -33,9 +33,9 @@
<field name="name">Date Filters</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">search.date.range.filter</field>
<field name="view_id" ref="date_range_filters_list"/>
<field name="view_id" ref="date_range_filters_list" />
</record>

<menuitem action="date_range_filters_action" id="date_range_filters_menu" parent="base.next_id_2" sequence="6"/>
<menuitem action="date_range_filters_action" id="date_range_filters_menu" parent="base.next_id_2" sequence="6" />

</odoo>
</odoo>
22 changes: 11 additions & 11 deletions web_search_date_range/views/search_date_range_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<form string="Date Range">
<sheet>
<group>
<field name="label"/>
<field name="domain"/>
<field name="sequence"/>
<field name="xml_id" options="{'no_create': 1}"/>
<field name="noupdate" attrs="{'readonly': [('xml_id', '=', False)]}"/>
<field name="label" />
<field name="domain" />
<field name="sequence" />
<field name="xml_id" options="{'no_create': 1}" />
<field name="noupdate" attrs="{'readonly': [('xml_id', '=', False)]}" />
</group>
</sheet>
</form>
Expand All @@ -24,9 +24,9 @@
<field name="model">search.date.range</field>
<field name="arch" type="xml">
<tree string="Date Ranges">
<field name="sequence" widget="handle"/>
<field name="label"/>
<field name="domain"/>
<field name="sequence" widget="handle" />
<field name="label" />
<field name="domain" />
</tree>
</field>
</record>
Expand All @@ -35,9 +35,9 @@
<field name="name">Date Ranges</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">search.date.range</field>
<field name="view_id" ref="date_range_list"/>
<field name="view_id" ref="date_range_list" />
</record>

<menuitem action="date_range_action" id="date_range_menu" parent="base.next_id_2" sequence="7"/>
<menuitem action="date_range_action" id="date_range_menu" parent="base.next_id_2" sequence="7" />

</odoo>
</odoo>

0 comments on commit fb6fc55

Please sign in to comment.