Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odoo CE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Comunitats Energètiques
Odoo CE
Merge requests
!134
Release v14.0.1.1.6
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Release v14.0.1.1.6
release/14.0.1.1.5
into
14.0
Overview
0
Commits
126
Pipelines
1
Changes
2
Merged
Daniil Digtyar Vasilieva
requested to merge
release/14.0.1.1.5
into
14.0
1 year ago
Overview
0
Commits
126
Pipelines
1
Changes
2
Expand
#TODO make changelog
0
0
Merge request reports
Viewing commit
7aa8985d
Prev
Next
Show latest version
2 files
+
25
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
7aa8985d
[IMP] added intelligent button to show distritbution tables
· 7aa8985d
Daniil Digtyar Vasilieva
authored
1 year ago
energy_selfconsumption/models/selfconsumption.py
+
18
−
0
Options
@@ -10,12 +10,30 @@ class Selfconsumption(models.Model):
}
_description
=
"
Self-consumption Energy Project
"
def
_compute_distribution_table_count
(
self
):
for
record
in
self
:
record
.
distribution_table_count
=
len
(
record
.
distribution_table_ids
)
project_id
=
fields
.
Many2one
(
"
energy_project.project
"
,
required
=
True
,
ondelete
=
"
cascade
"
)
code
=
fields
.
Char
(
string
=
"
CAU
"
)
power
=
fields
.
Float
(
string
=
"
Generation Power (kWh)
"
)
distribution_table_id
=
fields
.
Many2one
(
'
energy_selfconsumption.distribution_table
'
)
distribution_table_ids
=
fields
.
One2many
(
'
energy_selfconsumption.distribution_table
'
,
'
selfconsumption_project_id
'
,
readonly
=
True
)
distribution_table_count
=
fields
.
Integer
(
compute
=
_compute_distribution_table_count
)
def
get_distribution_tables
(
self
):
self
.
ensure_one
()
return
{
'
type
'
:
'
ir.actions.act_window
'
,
'
name
'
:
'
Distribution Tables
'
,
'
view_mode
'
:
'
tree,form
'
,
'
res_model
'
:
'
energy_selfconsumption.distribution_table
'
,
'
domain
'
:
[(
'
selfconsumption_project_id
'
,
'
=
'
,
self
.
id
)],
'
context
'
:
{
'
create
'
:
True
,
'
default_selfconsumption_project_id
'
:
self
.
id
},
}
def
set_activation
(
self
):
for
record
in
self
:
Loading