forked from OCA/project
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[14.0][BACKPORT] project_forecast_line_bokeh_chart from 15.0 to 14.0
- Loading branch information
1 parent
6e160e3
commit 8931632
Showing
4 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import models | ||
from . import report |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import forecast_line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright 2022 Therp BV <https://therp.nl>. | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
from odoo import api, models | ||
|
||
|
||
class ForecastLine(models.Model): | ||
|
||
_inherit = "forecast.line" | ||
|
||
@api.model | ||
def _read_group_raw( | ||
self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True | ||
): | ||
""" | ||
Inherit and add __range key, like in odoo 15 | ||
https://github.com/odoo/odoo/blob/15.0/odoo/models.py#L2431 | ||
""" | ||
result = super()._read_group_raw( | ||
domain, | ||
fields, | ||
groupby, | ||
offset=offset, | ||
limit=limit, | ||
orderby=orderby, | ||
lazy=lazy, | ||
) | ||
dt = [ | ||
f | ||
for f in groupby | ||
if self._fields[f.split(":")[0]].type | ||
in ("date", "datetime") # e.g. 'date:month' | ||
] | ||
for group in result: | ||
if dt: | ||
group["__range"] = {} | ||
for df in dt: | ||
field_name = df.split(":")[0] | ||
if group.get(df): | ||
range_from, range_to = group[df][0].split("/") | ||
group["__range"][field_name] = {"from": range_from, "to": range_to} | ||
else: | ||
group["__range"][field_name] = False | ||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
* Alexandre Fayolle <[email protected]> | ||
* Nikos Tsirintanis <[email protected]> |