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
0c19fc32
Commit
0c19fc32
authored
1 year ago
by
Emanuel Buzey
Committed by
Daniil Digtyar Vasilieva
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
[REF] energy_selfconsumption: remove field and key values depricated
parent
6b613511
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!253
[REL] Release 06/11/23
,
!228
[IMP] energy_selfconsumption: integration invoicing
,
!211
[IMP] energy_selfconsumption: invoicing acquired power
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
energy_selfconsumption/wizards/contract_generation_wizard.py
+1
-47
1 addition, 47 deletions
energy_selfconsumption/wizards/contract_generation_wizard.py
with
1 addition
and
47 deletions
energy_selfconsumption/wizards/contract_generation_wizard.py
+
1
−
47
View file @
0c19fc32
...
...
@@ -4,27 +4,6 @@ from odoo import _, fields, models
class
ContractGenerationWizard
(
models
.
TransientModel
):
_name
=
"
energy_selfconsumption.contract_generation.wizard
"
price_energy
=
fields
.
Float
(
string
=
"
Price (€/kWn/day)
"
)
recurring_interval
=
fields
.
Integer
(
default
=
1
,
string
=
"
Invoice Every
"
,
help
=
"
Invoice every (Days/Week/Month/Year)
"
,
)
recurring_rule_type
=
fields
.
Selection
(
[
(
"
daily
"
,
"
Day(s)
"
),
(
"
weekly
"
,
"
Week(s)
"
),
(
"
monthly
"
,
"
Month(s)
"
),
(
"
monthlylastday
"
,
"
Month(s) last day
"
),
(
"
quarterly
"
,
"
Quarter(s)
"
),
(
"
semesterly
"
,
"
Semester(s)
"
),
(
"
yearly
"
,
"
Year(s)
"
),
],
default
=
"
monthly
"
,
string
=
"
Recurrence
"
,
help
=
"
Specify Interval for automatic invoice generation.
"
,
)
selfconsumption_id
=
fields
.
Many2one
(
"
energy_selfconsumption.selfconsumption
"
,
readonly
=
True
)
...
...
@@ -46,29 +25,6 @@ class ContractGenerationWizard(models.TransientModel):
SomeException: When no distribution table in process of activation is found.
"""
# Create product
product_id
=
self
.
env
[
"
product.product
"
].
create
(
{
"
name
"
:
_
(
"
Energy Acquired - %s
"
)
%
(
self
.
selfconsumption_id
.
name
),
"
lst_price
"
:
self
.
price_energy
,
"
company_id
"
:
self
.
env
.
company
.
id
,
}
)
# Create contract formula
formula_contract_id
=
self
.
env
[
"
contract.line.qty.formula
"
].
create
(
{
"
name
"
:
_
(
"
Formula - %s
"
)
%
(
self
.
selfconsumption_id
.
name
),
"
code
"
:
"""
days_timedelta = line.next_period_date_end - line.next_period_date_start
if days_timedelta:
# Add one so it counts the same day too (month = 29 + 1)
days_between = days_timedelta.days + 1
else:
days_between = 0
result = line.supply_point_assignation_id.distribution_table_id.selfconsumption_project_id.power * line.supply_point_assignation_id.coefficient * days_between
"""
,
}
product_id
=
self
.
selfconsumption_id
.
product_id
formula_contract_id
=
(
self
.
selfconsumption_id
.
contract_template_id
.
contract_line_ids
.
qty_formula_id
...
...
@@ -125,14 +81,12 @@ result = line.supply_point_assignation_id.distribution_table_id.selfconsumption_
),
"
partner_id
"
:
supply_point_assignation
.
supply_point_id
.
partner_id
.
id
,
"
invoice_partner_id
"
:
supply_point_assignation
.
supply_point_id
.
partner_id
.
id
,
"
journal_id
"
:
journal_id
.
id
,
"
recurring_interval
"
:
self
.
recurring_interval
,
"
recurring_rule_type
"
:
self
.
recurring_rule_type
,
"
recurring_invoicing_type
"
:
"
post-paid
"
,
"
date_start
"
:
fields
.
date
.
today
(),
"
company_id
"
:
self
.
env
.
company
.
id
,
"
contract_line_ids
"
:
contract_lines
,
"
project_id
"
:
self
.
selfconsumption_id
.
project_id
.
id
,
"
contract_template_id
"
:
self
.
selfconsumption_id
.
contract_template_id
.
id
,
}
)
...
...
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