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
Commits
4c946f12
Commit
4c946f12
authored
1 year ago
by
Daniil Digtyar Vasilieva
Browse files
Options
Downloads
Patches
Plain Diff
[IMP] filter out supply already in the distribution table
parent
ee5bab76
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!138
Hotfix setup name error
,
!134
Release v14.0.1.1.6
,
!126
[IMP] Feature/add energy selfconsumption distribution table
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
energy_selfconsumption/models/supply_point_assignation.py
+11
-3
11 additions, 3 deletions
energy_selfconsumption/models/supply_point_assignation.py
with
11 additions
and
3 deletions
energy_selfconsumption/models/supply_point_assignation.py
+
11
−
3
View file @
4c946f12
from
odoo
import
fields
,
models
,
api
class
SupplyPointAssignation
(
models
.
Model
):
_name
=
'
energy_selfconsumption.supply_point_assignation
'
_description
=
'
Supply Point Assignation
'
@api.depends
(
'
distribution_table_id
'
)
def
_compute_supply_point_filtered_ids
(
self
):
'''
List of supply point of partners subscribed to the project and not in the list of the distribution table to
prevent multiple assignations of same supply point.
Used to filter out in the view.
:return:
'''
for
record
in
self
:
record
.
supply_point_filtered_ids
=
record
.
distribution_table_id
.
selfconsumption_project_id
.
inscription_ids
.
mapped
(
'
partner_id.supply_ids
'
)
record
.
supply_point_filtered_ids
=
\
record
.
distribution_table_id
.
selfconsumption_project_id
.
inscription_ids
.
mapped
(
'
partner_id.supply_ids
'
)
\
.
filtered_domain
([(
'
id
'
,
'
not in
'
,
record
.
distribution_table_id
.
supply_point_assignation_ids
.
mapped
(
'
supply_point_id.id
'
))])
distribution_table_id
=
fields
.
Many2one
(
'
energy_selfconsumption.distribution_table
'
,
required
=
True
)
supply_point_id
=
fields
.
Many2one
(
'
energy_selfconsumption.supply_point
'
,
required
=
True
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment