Skip to content
Extraits de code Groupes Projets
Valider bdce9428 rédigé par Rémi - Le Filament's avatar Rémi - Le Filament
Parcourir les fichiers

[REF] add periods to PRM

parent 58a384c8
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -12,11 +12,15 @@ exclude: | ...@@ -12,11 +12,15 @@ exclude: |
/static/(src/)?lib/| /static/(src/)?lib/|
# Repos using Sphinx to generate docs don't need prettying # Repos using Sphinx to generate docs don't need prettying
^docs/_templates/.*\.html$| ^docs/_templates/.*\.html$|
# Don't bother non-technical authors with formatting issues in docs
readme/.*\.(rst|md)$|
# Ignore build and dist directories in addons
/build/|/dist/|
# You don't usually want a bot to modify your legal texts # You don't usually want a bot to modify your legal texts
(LICENSE.*|COPYING.*) (LICENSE.*|COPYING.*)
default_language_version: default_language_version:
python: python3 python: python3
node: "14.13.0" node: "16.17.0"
repos: repos:
- repo: local - repo: local
hooks: hooks:
...@@ -33,40 +37,38 @@ repos: ...@@ -33,40 +37,38 @@ repos:
language: fail language: fail
files: '[a-zA-Z0-9_]*/i18n/en\.po$' files: '[a-zA-Z0-9_]*/i18n/en\.po$'
- repo: https://github.com/oca/maintainer-tools - repo: https://github.com/oca/maintainer-tools
rev: ab1d7f6 rev: f71041f22b8cd68cf7c77b73a14ca8d8cd190a60
hooks: hooks:
# update the NOT INSTALLABLE ADDONS section above # update the NOT INSTALLABLE ADDONS section above
- id: oca-update-pre-commit-excluded-addons - id: oca-update-pre-commit-excluded-addons
- id: oca-fix-manifest-website - id: oca-fix-manifest-website
args: ["https://le-filament.com"] args: ["https://le-filament.com"]
- repo: https://github.com/myint/autoflake - id: oca-gen-addon-readme
rev: v1.4
hooks:
- id: autoflake
args: args:
- --expand-star-imports - --addons-dir=.
- --ignore-init-module-imports - --branch=16.0
- --in-place - --org-name=lefilament
- --remove-all-unused-imports - --repo-name=template_module
- --remove-duplicate-keys - --if-source-changed
- --remove-unused-variables - --keep-source-digest
- repo: https://github.com/psf/black - repo: https://github.com/OCA/odoo-pre-commit-hooks
rev: 22.3.0 rev: v0.0.25
hooks: hooks:
- id: black - id: oca-checks-odoo-module
- id: oca-checks-po
- repo: https://github.com/pre-commit/mirrors-prettier - repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.1.2 rev: v2.7.1
hooks: hooks:
- id: prettier - id: prettier
name: prettier (with plugin-xml) name: prettier (with plugin-xml)
additional_dependencies: additional_dependencies:
- "prettier@2.1.2" - "prettier@2.7.1"
- "@prettier/plugin-xml@0.12.0" - "@prettier/plugin-xml@2.2.0"
args: args:
- --plugin=@prettier/plugin-xml - --plugin=@prettier/plugin-xml
files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$ files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$
- repo: https://github.com/pre-commit/mirrors-eslint - repo: https://github.com/pre-commit/mirrors-eslint
rev: v7.8.1 rev: v8.24.0
hooks: hooks:
- id: eslint - id: eslint
verbose: true verbose: true
...@@ -74,7 +76,7 @@ repos: ...@@ -74,7 +76,7 @@ repos:
- --color - --color
- --fix - --fix
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0 rev: v4.3.0
hooks: hooks:
- id: trailing-whitespace - id: trailing-whitespace
# exclude autogenerated files # exclude autogenerated files
...@@ -95,27 +97,14 @@ repos: ...@@ -95,27 +97,14 @@ repos:
- id: check-xml - id: check-xml
- id: mixed-line-ending - id: mixed-line-ending
args: ["--fix=lf"] args: ["--fix=lf"]
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v2.7.2 rev: v0.1.3
hooks:
- id: pyupgrade
args: ["--keep-percent-format"]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
name: isort except __init__.py
args:
- --settings=.
exclude: /__init__\.py$
- repo: https://github.com/PyCQA/flake8
rev: 3.8.3
hooks: hooks:
- id: flake8 - id: ruff
name: flake8 args: [--fix, --exit-non-zero-on-fix]
additional_dependencies: ["flake8-bugbear==20.1.4"] - id: ruff-format
- repo: https://github.com/OCA/pylint-odoo - repo: https://github.com/OCA/pylint-odoo
rev: 7.0.2 rev: v8.0.19
hooks: hooks:
- id: pylint_odoo - id: pylint_odoo
name: pylint with optional checks name: pylint with optional checks
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import http from odoo import http
from odoo.addons.oacc_portal.controllers.main import \
CustomerPortal as CustomerPortal
from odoo.http import request from odoo.http import request
from odoo.addons.oacc_portal.controllers.main import CustomerPortal as CustomerPortal
class CustomerPortal(CustomerPortal): class CustomerPortal(CustomerPortal):
def _get_data_date(self, is_data_cdc, operation=None): def _get_data_date(self, is_data_cdc, operation=None):
...@@ -68,7 +68,7 @@ class CustomerPortal(CustomerPortal): ...@@ -68,7 +68,7 @@ class CustomerPortal(CustomerPortal):
self._get_data_date(render_values.get("isDataCdc"), operation) self._get_data_date(render_values.get("isDataCdc"), operation)
) )
partner_ids = operation.acc_delivery_ids.mapped("partner_id").sorted( partner_ids = operation.acc_delivery_period_ids.mapped("partner_id").sorted(
key=lambda p: p.name key=lambda p: p.name
) )
render_values.update( render_values.update(
...@@ -100,7 +100,7 @@ class CustomerPortal(CustomerPortal): ...@@ -100,7 +100,7 @@ class CustomerPortal(CustomerPortal):
self._get_data_date(render_values.get("isDataCdc"), operation) self._get_data_date(render_values.get("isDataCdc"), operation)
) )
partner_ids = operation.acc_injection_ids.mapped("partner_id").sorted( partner_ids = operation.acc_injection_period_ids.mapped("partner_id").sorted(
key=lambda p: p.name key=lambda p: p.name
) )
render_values.update( render_values.update(
......
...@@ -44,21 +44,21 @@ class AccOperation(models.Model): ...@@ -44,21 +44,21 @@ class AccOperation(models.Model):
values = {} values = {}
last_record = self.get_last_cdc_record() last_record = self.get_last_cdc_record()
date_day_start, date_day_end = self.get_last_day("day", last_record) date_day_start, date_day_end = self.get_interval("day", last_record)
date_day_start = date_day_start.strftime("%d/%m/%Y") date_day_start = date_day_start.strftime("%d/%m/%Y")
date_day_end = date_day_end.strftime("%d/%m/%Y") date_day_end = date_day_end.strftime("%d/%m/%Y")
date_week_start, date_week_end = self.get_last_day("week", last_record) date_week_start, date_week_end = self.get_interval("week", last_record)
date_week_start = date_week_start.strftime("%d/%m/%Y") date_week_start = date_week_start.strftime("%d/%m/%Y")
date_week_end = date_week_end.strftime("%d/%m/%Y") date_week_end = date_week_end.strftime("%d/%m/%Y")
date_month_start, date_month_end = self.get_last_day("month", last_record) date_month_start, date_month_end = self.get_interval("month", last_record)
date_month_start = date_month_start.strftime("%d/%m/%Y") date_month_start = date_month_start.strftime("%d/%m/%Y")
date_month_end = date_month_end.strftime("%d/%m/%Y") date_month_end = date_month_end.strftime("%d/%m/%Y")
date_year_start, date_year_end = self.get_last_day("year", last_record) date_year_start, date_year_end = self.get_interval("year", last_record)
date_year_start = date_year_start.strftime("%d/%m/%Y") date_year_start = date_year_start.strftime("%d/%m/%Y")
date_year_end = date_year_end.strftime("%d/%m/%Y") date_year_end = date_year_end.strftime("%d/%m/%Y")
...@@ -75,12 +75,3 @@ class AccOperation(models.Model): ...@@ -75,12 +75,3 @@ class AccOperation(models.Model):
} }
return values return values
def get_date_min_max(self):
self.ensure_one()
last_record = self.get_last_cdc_record()
date_deb, date_max = self.get_last_day("day", last_record)
date_max = date_max.strftime("%d/%m/%Y")
date_min = self.date_start_contract.strftime("%d/%m/%Y")
vals = {"date_min": date_min, "date_max": date_max}
return vals
...@@ -15,26 +15,18 @@ ...@@ -15,26 +15,18 @@
</div> </div>
<div class="row bg-white pt-3 pb-3 text-center"> <div class="row bg-white pt-3 pb-3 text-center">
<div class="col-12 col-lg-6 p-3"> <div class="col-12 col-lg-6 p-3">
<h2 class="sticky-top bg-white py-2">La Consommation</h2> <h2
<t class="sticky-top bg-white py-2"
t-call="oacc_portal_overview_cdc.profil_conso" >La Consommation</h2>
/> <t t-call="oacc_portal_overview_cdc.profil_conso" />
<t <t t-call="oacc_portal_overview_cdc.bilan_conso" />
t-call="oacc_portal_overview_cdc.bilan_conso" <t t-call="oacc_portal_overview_cdc.cdc_conso" />
/>
<t
t-call="oacc_portal_overview_cdc.cdc_conso"
/>
</div> </div>
<div class="col-12 col-lg-6 p-3"> <div class="col-12 col-lg-6 p-3">
<h2 class="sticky-top bg-white py-2">La Production</h2> <h2 class="sticky-top bg-white py-2">La Production</h2>
<t <t t-call="oacc_portal_overview_cdc.profil_prod" />
t-call="oacc_portal_overview_cdc.profil_prod" <t t-call="oacc_portal_overview_cdc.bilan_prod" />
/>
<t
t-call="oacc_portal_overview_cdc.bilan_prod"
/>
<t t-call="oacc_portal_overview_cdc.cdc_prod" /> <t t-call="oacc_portal_overview_cdc.cdc_prod" />
</div> </div>
...@@ -53,25 +45,17 @@ ...@@ -53,25 +45,17 @@
t-att-data-id="operation.id" t-att-data-id="operation.id"
> >
<div class="row"> <div class="row">
<t <t t-call="oacc_portal_overview_cdc.nav_button" />
t-call="oacc_portal_overview_cdc.nav_button"
/>
</div> </div>
<div class="row mb32 bg-white op-detail"> <div class="row mb32 bg-white op-detail">
<div class="col-12 col-lg-6 p-3"> <div class="col-12 col-lg-6 p-3">
<t <t t-call="oacc_portal_overview_cdc.profil_conso" />
t-call="oacc_portal_overview_cdc.profil_conso"
/>
</div> </div>
<div class="col-12 col-lg-6 p-3"> <div class="col-12 col-lg-6 p-3">
<t <t t-call="oacc_portal_overview_cdc.bilan_conso" />
t-call="oacc_portal_overview_cdc.bilan_conso"
/>
</div> </div>
<div class="col-12 p-3"> <div class="col-12 p-3">
<t <t t-call="oacc_portal_overview_cdc.cdc_conso" />
t-call="oacc_portal_overview_cdc.cdc_conso"
/>
</div> </div>
</div> </div>
</div> </div>
...@@ -88,26 +72,18 @@ ...@@ -88,26 +72,18 @@
t-att-data-id="operation.id" t-att-data-id="operation.id"
> >
<div class="row"> <div class="row">
<t <t t-call="oacc_portal_overview_cdc.nav_button" />
t-call="oacc_portal_overview_cdc.nav_button"
/>
</div> </div>
<div class="row mb32 bg-white op-detail"> <div class="row mb32 bg-white op-detail">
<div class="col-12 col-lg-6 p-3"> <div class="col-12 col-lg-6 p-3">
<t <t t-call="oacc_portal_overview_cdc.profil_prod" />
t-call="oacc_portal_overview_cdc.profil_prod"
/>
</div> </div>
<div class="col-12 col-lg-6 p-3"> <div class="col-12 col-lg-6 p-3">
<t <t t-call="oacc_portal_overview_cdc.bilan_prod" />
t-call="oacc_portal_overview_cdc.bilan_prod"
/>
</div> </div>
<div class="col-12 p-3"> <div class="col-12 p-3">
<t <t t-call="oacc_portal_overview_cdc.cdc_prod" />
t-call="oacc_portal_overview_cdc.cdc_prod"
/>
</div> </div>
</div> </div>
</div> </div>
...@@ -123,7 +99,9 @@ ...@@ -123,7 +99,9 @@
<t t-elif="type_data == 'prod' and len(partners) > 1"> <t t-elif="type_data == 'prod' and len(partners) > 1">
<h3 class="title_cdc mt-2">Production globale</h3> <h3 class="title_cdc mt-2">Production globale</h3>
</t> </t>
<t t-elif="type_data in ('cons', 'prod') and len(partners) == 1"> <t
t-elif="type_data in ('cons', 'prod') and len(partners) == 1"
>
<h3 class="title_cdc mt-2"> <h3 class="title_cdc mt-2">
<t t-out="partners[0].sudo().name" /> <t t-out="partners[0].sudo().name" />
</h3> </h3>
...@@ -137,7 +115,9 @@ ...@@ -137,7 +115,9 @@
</div> </div>
<div class="col-10 col-xl-5"> <div class="col-10 col-xl-5">
<!-- Buttons period --> <!-- Buttons period -->
<div class="btn-period-group d-flex justify-content-evenly flex-wrap"> <div
class="btn-period-group d-flex justify-content-evenly flex-wrap"
>
<button <button
t-att-value="{'first_day': data_values['date_day_start'] or '', 'last_day': data_values['date_day_end' or '']}" t-att-value="{'first_day': data_values['date_day_start'] or '', 'last_day': data_values['date_day_end' or '']}"
name="day" name="day"
...@@ -195,24 +175,36 @@ ...@@ -195,24 +175,36 @@
<button id="previous-period" class="btn btn-light"> <button id="previous-period" class="btn btn-light">
<i class="fa fa-angle-double-left" /> <i class="fa fa-angle-double-left" />
</button> </button>
<input type="text" name="daterange" class="form-control text-center" /> <input
type="text"
name="daterange"
class="form-control text-center"
/>
<button id="next-period" class="btn btn-light"> <button id="next-period" class="btn btn-light">
<i class="fa fa-angle-double-right" /> <i class="fa fa-angle-double-right" />
</button> </button>
</div> </div>
</div> </div>
</div> </div>
<div class="col-2 col-xl-1 align-self-center mt-4 mt-lg-0" t-if="partners"> <div
class="col-2 col-xl-1 align-self-center mt-4 mt-lg-0"
t-if="partners"
>
PRM ou contact PRM ou contact
</div> </div>
<div class="col-10 col-xl-5 align-self-center mt-4 mt-lg-0" t-if="partners"> <div
class="col-10 col-xl-5 align-self-center mt-4 mt-lg-0"
t-if="partners"
>
<div class="prm-selection align-items-center d-flex"> <div class="prm-selection align-items-center d-flex">
<select <select
class="form-select" class="form-select"
aria-label="prm-selection" aria-label="prm-selection"
name="endpoint" name="endpoint"
> >
<t t-if="len(partners) > 1 and type_data in ['cons', 'prod']"> <t
t-if="len(partners) > 1 and type_data in ['cons', 'prod']"
>
<option <option
value="all" value="all"
t-att-data-name="'Consommation globale' if type_data == 'cons' else 'Production globale'" t-att-data-name="'Consommation globale' if type_data == 'cons' else 'Production globale'"
...@@ -229,20 +221,26 @@ ...@@ -229,20 +221,26 @@
<t <t
t-set="prm_ids" t-set="prm_ids"
t-if="type_data == 'cons'" t-if="type_data == 'cons'"
t-value="operation.acc_delivery_ids.filtered(lambda r: r.partner_id == p)" t-value="operation.acc_delivery_period_ids.filtered(lambda r: r.partner_id == p).mapped('acc_counter_id')"
/> />
<t <t
t-set="prm_ids" t-set="prm_ids"
t-if="type_data == 'prod'" t-if="type_data == 'prod'"
t-value="operation.acc_injection_ids.filtered(lambda r: r.partner_id == p)" t-value="operation.acc_injection_period_ids.filtered(lambda r: r.partner_id == p).mapped('acc_counter_id')"
/> />
<t t-foreach="prm_ids" t-as="prm" class="nav-item"> <t
t-foreach="prm_ids"
t-as="prm"
class="nav-item"
>
<option <option
t-att-value="prm.id" t-att-value="prm.id"
t-att-data-name="'PRM n°' + prm.name" t-att-data-name="'PRM n°' + prm.name"
t-att-data-prm-id="prm.id" t-att-data-prm-id="prm.id"
> >
&#160;&#160;&#160;- <t t-out="(prm.street + ' - ' + prm.name) if prm.street else prm.name" /> &#160;&#160;&#160;- <t
t-out="(prm.street + ' - ' + prm.name) if prm.street else prm.name"
/>
</option> </option>
</t> </t>
</t> </t>
...@@ -258,8 +256,8 @@ ...@@ -258,8 +256,8 @@
<template id="profil_conso"> <template id="profil_conso">
<div class="text-center mb-4 p-3 shadow op-graph"> <div class="text-center mb-4 p-3 shadow op-graph">
<h3>Profil</h3> <h3>Profil</h3>
<p <p>Cliquez sur les termes « AutoConso » ou « AlloConso »<br
>Cliquez sur les termes « AutoConso » ou « AlloConso »<br/>pour faire apparaître ou disparaître les données correspondantes.</p> />pour faire apparaître ou disparaître les données correspondantes.</p>
<div class="chart-container"> <div class="chart-container">
<canvas <canvas
id="histo_chart_conso" id="histo_chart_conso"
...@@ -288,7 +286,8 @@ ...@@ -288,7 +286,8 @@
<div class="js_curv_line text-center p-3 shadow op-graph"> <div class="js_curv_line text-center p-3 shadow op-graph">
<h3>Courbe de charge</h3> <h3>Courbe de charge</h3>
<p <p
>Cliquez sur les termes « Conso », « Production solaire » ou « AutoConso »<br/>pour faire apparaître ou disparaître les courbes correspondantes.</p> >Cliquez sur les termes « Conso », « Production solaire » ou « AutoConso »<br
/>pour faire apparaître ou disparaître les courbes correspondantes.</p>
<div class="chart-container"> <div class="chart-container">
<canvas <canvas
id="line_chart_conso" id="line_chart_conso"
...@@ -302,8 +301,8 @@ ...@@ -302,8 +301,8 @@
<template id="profil_prod"> <template id="profil_prod">
<div class="text-center mb-4 p-3 shadow op-graph"> <div class="text-center mb-4 p-3 shadow op-graph">
<h3>Profil</h3> <h3>Profil</h3>
<p <p>Cliquez sur les termes « AutoConso » ou « Surplus »<br
>Cliquez sur les termes « AutoConso » ou « Surplus »<br/>pour faire apparaître ou disparaître les données correspondantes.</p> />pour faire apparaître ou disparaître les données correspondantes.</p>
<div class="chart-container"> <div class="chart-container">
<canvas <canvas
id="histo_chart_prod" id="histo_chart_prod"
...@@ -331,8 +330,8 @@ ...@@ -331,8 +330,8 @@
<template id="cdc_prod"> <template id="cdc_prod">
<div class="js_curv_line text-center p-3 shadow op-graph"> <div class="js_curv_line text-center p-3 shadow op-graph">
<h3>Courbe de charge</h3> <h3>Courbe de charge</h3>
<p <p>Cliquez sur les termes « AutoConso » ou « Surplus »<br
>Cliquez sur les termes « AutoConso » ou « Surplus »<br/>pour faire apparaître ou disparaître les courbes correspondantes.</p> />pour faire apparaître ou disparaître les courbes correspondantes.</p>
<div class="chart-container"> <div class="chart-container">
<canvas <canvas
id="line_chart_prod" id="line_chart_prod"
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter