Skip to content

Commit 4fbfef2

Browse files
[19.0][ADD] web_grid_view: add community grid view type
Adds a 2D grid view type to Odoo, with row/section grouping, date columns (day/week/month/year ranges), measures, inline cell editing, section and column totals, a magnifier to open a cell's records, and a demo grid view on ir.cron.
1 parent e6ced50 commit 4fbfef2

42 files changed

Lines changed: 2637 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

web_grid_view/README.rst

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
.. image:: https://odoo-community.org/readme-banner-image
2+
:target: https://odoo-community.org/get-involved?utm_source=readme
3+
:alt: Odoo Community Association
4+
5+
=============
6+
Web Grid View
7+
=============
8+
9+
..
10+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11+
!! This file is generated by oca-gen-addon-readme !!
12+
!! changes will be overwritten. !!
13+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14+
!! source digest: sha256:5fcda0b93371a2b7b056339f84c77e75bcbf611ad069e010960ca45920d1fb05
15+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16+
17+
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
18+
:target: https://odoo-community.org/page/development-status
19+
:alt: Alpha
20+
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
21+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
22+
:alt: License: AGPL-3
23+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
24+
:target: https://github.com/OCA/web/tree/19.0/web_grid_view
25+
:alt: OCA/web
26+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27+
:target: https://translation.odoo-community.org/projects/web-19-0/web-19-0-web_grid_view
28+
:alt: Translate me on Weblate
29+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=19.0
31+
:alt: Try me on Runboat
32+
33+
|badge1| |badge2| |badge3| |badge4| |badge5|
34+
35+
This module adds a **Grid View** type to Odoo Community Edition.
36+
37+
It provides a 2-dimensional table where rows represent grouped records,
38+
columns represent time periods or discrete values, and cells show an
39+
aggregated measure (sum, average, etc.). Cells can be edited inline when
40+
the measure uses the sum operator.
41+
42+
Useful for timesheets, planning, forecasting and any data that fits a
43+
row/column/date matrix layout.
44+
45+
.. IMPORTANT::
46+
This is an alpha version, the data model and design can change at any time without warning.
47+
Only for development or testing purpose, do not use in production.
48+
`More details on development status <https://odoo-community.org/page/development-status>`_
49+
50+
**Table of contents**
51+
52+
.. contents::
53+
:local:
54+
55+
Usage
56+
=====
57+
58+
To add a grid view to a model, define a <grid> view in XML and add grid
59+
to the action's view_mode.
60+
61+
.. code:: xml
62+
63+
<record id="my_grid_view" model="ir.ui.view">
64+
<field name="name">my.model.grid</field>
65+
<field name="model">my.model</field>
66+
<field name="arch" type="xml">
67+
<grid string="My Grid" editable="1">
68+
<field name="my_row_field" type="row" section="1"/>
69+
<field name="my_date_field" type="col">
70+
<range name="day" string="Day" span="day" step="day"/>
71+
<range name="week" string="Week" span="week" step="day" default="1"/>
72+
<range name="month" string="Month" span="month" step="day"/>
73+
</field>
74+
<field name="my_measure_field" type="measure" widget="float"/>
75+
</grid>
76+
</field>
77+
</record>
78+
79+
Changelog
80+
=========
81+
82+
19.0.1.0.0 (2026-08-07)
83+
-----------------------
84+
85+
First release.
86+
87+
Bug Tracker
88+
===========
89+
90+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
91+
In case of trouble, please check there if your issue has already been reported.
92+
If you spotted it first, help us to smash it by providing a detailed and welcomed
93+
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_grid_view%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
94+
95+
Do not contact contributors directly about support or help with technical issues.
96+
97+
Credits
98+
=======
99+
100+
Authors
101+
-------
102+
103+
* Domatix
104+
105+
Contributors
106+
------------
107+
108+
- `Domatix <https://www.domatix.com>`__:
109+
110+
- Alvaro <alvaro@domatix.com>
111+
112+
Maintainers
113+
-----------
114+
115+
This module is maintained by the OCA.
116+
117+
.. image:: https://odoo-community.org/logo.png
118+
:alt: Odoo Community Association
119+
:target: https://odoo-community.org
120+
121+
OCA, or the Odoo Community Association, is a nonprofit organization whose
122+
mission is to support the collaborative development of Odoo features and
123+
promote its widespread use.
124+
125+
This module is part of the `OCA/web <https://github.com/OCA/web/tree/19.0/web_grid_view>`_ project on GitHub.
126+
127+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

web_grid_view/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright 2026 Domatix
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from . import models

web_grid_view/__manifest__.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright 2026 Domatix
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Web Grid View",
6+
"summary": "2D grid view for Odoo",
7+
"version": "19.0.1.0.0",
8+
"development_status": "Alpha",
9+
"author": "Domatix, Odoo Community Association (OCA)",
10+
"category": "Hidden",
11+
"license": "AGPL-3",
12+
"website": "https://github.com/OCA/web",
13+
"depends": ["web"],
14+
"data": [],
15+
"demo": [
16+
"demo/ir_cron_view.xml",
17+
],
18+
"assets": {
19+
"web.assets_backend": [
20+
"web_grid_view/static/src/views/grid/grid_view.scss",
21+
"web_grid_view/static/src/views/grid/grid_renderer.scss",
22+
"web_grid_view/static/src/hooks/input_hook.esm.js",
23+
"web_grid_view/static/src/components/grid_cell.esm.js",
24+
"web_grid_view/static/src/components/grid_cell.xml",
25+
"web_grid_view/static/src/components/grid_component.esm.js",
26+
"web_grid_view/static/src/components/grid_component.xml",
27+
"web_grid_view/static/src/components/grid_row.esm.js",
28+
"web_grid_view/static/src/components/grid_row.xml",
29+
"web_grid_view/static/src/components/many2one_grid_row.esm.js",
30+
"web_grid_view/static/src/components/many2one_grid_row.xml",
31+
"web_grid_view/static/src/components/float_factor_grid_cell.esm.js",
32+
"web_grid_view/static/src/components/float_time_grid_cell.esm.js",
33+
"web_grid_view/static/src/components/float_toggle_grid_cell.esm.js",
34+
"web_grid_view/static/src/components/float_toggle_grid_cell.xml",
35+
"web_grid_view/static/src/views/grid/grid_arch_parser.esm.js",
36+
"web_grid_view/static/src/views/grid/grid_model.esm.js",
37+
"web_grid_view/static/src/views/grid/grid_renderer.esm.js",
38+
"web_grid_view/static/src/views/grid/grid_renderer.xml",
39+
"web_grid_view/static/src/views/grid/grid_controller.esm.js",
40+
"web_grid_view/static/src/views/grid/grid_controller.xml",
41+
"web_grid_view/static/src/views/grid/grid_view.esm.js",
42+
],
43+
"web.assets_unit_tests": [
44+
"web_grid_view/static/tests/grid_view.test.js",
45+
],
46+
},
47+
"installable": True,
48+
"application": False,
49+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<odoo>
3+
<!-- Add a demo grid view on cron jobs to showcase this module. -->
4+
<record id="ir_cron_grid_view" model="ir.ui.view">
5+
<field name="name">ir.cron.grid.view</field>
6+
<field name="model">ir.cron</field>
7+
<field name="type">grid_view</field>
8+
<field name="arch" type="xml">
9+
<grid_view string="Scheduled Actions">
10+
<field name="interval_type" type="row" section="1" />
11+
<field name="user_id" type="row" />
12+
<field name="nextcall" type="col">
13+
<range name="day" string="Day" span="day" step="day" />
14+
<range
15+
name="week"
16+
string="Week"
17+
span="week"
18+
step="day"
19+
default="1"
20+
/>
21+
<range name="month" string="Month" span="month" step="day" />
22+
</field>
23+
<field
24+
name="id"
25+
type="measure"
26+
operator="count_distinct"
27+
string="Actions"
28+
/>
29+
</grid_view>
30+
</field>
31+
</record>
32+
33+
<!--
34+
Append grid_view to the existing "Scheduled Actions" action so the view
35+
is reachable through the standard ir.cron menu, without adding a custom
36+
menu, action or model.
37+
-->
38+
<function model="ir.actions.act_window" name="write">
39+
<value eval="[ref('base.ir_cron_act')]" />
40+
<value
41+
model="ir.actions.act_window"
42+
eval="{
43+
'view_mode': obj().env.ref('base.ir_cron_act').view_mode + ',grid_view',
44+
'view_ids': [
45+
Command.create({
46+
'view_mode': 'grid_view',
47+
'view_id': ref('ir_cron_grid_view'),
48+
}),
49+
],
50+
}"
51+
/>
52+
</function>
53+
</odoo>

web_grid_view/i18n/.gitkeep

Whitespace-only changes.

web_grid_view/models/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright 2026 Domatix
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from . import ir_ui_view
5+
from . import ir_actions
6+
from . import models

web_grid_view/models/ir_actions.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2026 Domatix
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class IrActionsActWindowView(models.Model):
8+
_inherit = "ir.actions.act_window.view"
9+
10+
view_mode = fields.Selection(
11+
selection_add=[("grid_view", "Grid")],
12+
ondelete={"grid_view": "cascade"},
13+
)

web_grid_view/models/ir_ui_view.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2026 Domatix
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
GRID_VIEW = ("grid_view", "Grid")
7+
8+
9+
class IrUIView(models.Model):
10+
_inherit = "ir.ui.view"
11+
12+
type = fields.Selection(selection_add=[GRID_VIEW])
13+
14+
def _is_qweb_based_view(self, view_type):
15+
return view_type == GRID_VIEW[0] or super()._is_qweb_based_view(view_type)
16+
17+
def _get_view_info(self):
18+
return {"grid_view": {"icon": "fa fa-th"}} | super()._get_view_info()

web_grid_view/models/models.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2026 Domatix
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import models
5+
6+
7+
class Base(models.AbstractModel):
8+
_inherit = "base"
9+
10+
def grid_update_cell(self, *args, **kwargs):
11+
"""Override to enable inline cell editing in grid views.
12+
13+
Called when a cell value is modified. The default behaviour disables
14+
editing (a model must override this method to implement the update).
15+
When another module also defines it (e.g. Enterprise ``web_grid``),
16+
defer to that implementation so the two can coexist in the same
17+
database.
18+
"""
19+
super_method = getattr(super(), "grid_update_cell", None)
20+
if super_method is not None:
21+
return super_method(*args, **kwargs)
22+
raise NotImplementedError(
23+
"grid_update_cell must be overridden to enable cell editing"
24+
)
25+
26+
# ``grid_unavailability`` is intentionally NOT defined here: the Community
27+
# grid view does not call it, and declaring it on ``base`` would collide
28+
# with Enterprise's ``web_grid`` when both are installed. A Community model
29+
# that needs to grey out days may override ``grid_unavailability`` itself.

web_grid_view/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"

0 commit comments

Comments
 (0)