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
91c77aba
Commit
91c77aba
authored
1 year ago
by
Daniil Digtyar Vasilieva
Browse files
Options
Downloads
Patches
Plain Diff
[FIX]energy_selfconsumption: not search if vat is not assigned
parent
3b799329
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!187
Release 14.0.1.1.13
,
!155
[IMP] energy_selfconsumption: importation of selfconsumption inscriptions, supply points and distribution tables by CSV
Pipeline
#38761
passed
1 year ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
energy_selfconsumption/wizards/selfconsumption_import_wizard.py
+23
-20
23 additions, 20 deletions
..._selfconsumption/wizards/selfconsumption_import_wizard.py
with
23 additions
and
20 deletions
energy_selfconsumption/wizards/selfconsumption_import_wizard.py
+
23
−
20
View file @
91c77aba
...
...
@@ -173,26 +173,29 @@ class SelfconsumptionImportWizard(models.TransientModel):
return
True
,
False
def
create_supply_point
(
self
,
line_dict
,
partner
):
owner
=
self
.
env
[
"
res.partner
"
].
search
(
[
"
|
"
,
(
"
vat
"
,
"
=
"
,
line_dict
[
"
owner_vat
"
]),
(
"
vat
"
,
"
=ilike
"
,
line_dict
[
"
owner_vat
"
]),
],
limit
=
1
,
)
if
not
owner
:
try
:
owner
=
self
.
env
[
"
res.partner
"
].
create
(
{
"
vat
"
:
line_dict
[
"
owner_vat
"
],
"
firstname
"
:
line_dict
[
"
owner_firstname
"
],
"
lastname
"
:
line_dict
[
"
owner_lastname
"
],
"
company_type
"
:
"
person
"
,
}
)
except
Exception
as
e
:
return
False
,
_
(
"
Owner could not be created: {error}
"
).
format
(
error
=
e
)
if
line_dict
[
"
owner_vat
"
]:
owner
=
self
.
env
[
"
res.partner
"
].
search
(
[
"
|
"
,
(
"
vat
"
,
"
=
"
,
line_dict
[
"
owner_vat
"
]),
(
"
vat
"
,
"
=ilike
"
,
line_dict
[
"
owner_vat
"
]),
],
limit
=
1
,
)
if
not
owner
:
try
:
owner
=
self
.
env
[
"
res.partner
"
].
create
(
{
"
vat
"
:
line_dict
[
"
owner_vat
"
],
"
firstname
"
:
line_dict
[
"
owner_firstname
"
],
"
lastname
"
:
line_dict
[
"
owner_lastname
"
],
"
company_type
"
:
"
person
"
,
}
)
except
Exception
as
e
:
return
False
,
_
(
"
Owner could not be created: {error}
"
).
format
(
error
=
e
)
else
:
owner
=
partner
country
=
self
.
env
[
"
res.country
"
].
search
([(
"
code
"
,
"
=
"
,
line_dict
[
"
country
"
])])
if
not
country
:
return
False
,
_
(
"
Country code was not found: {country}
"
).
format
(
...
...
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