Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
health_insurance
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
sofsa
health_insurance
Commits
a379347f
Commit
a379347f
authored
4 years ago
by
Marco Folco
Browse files
Options
Downloads
Patches
Plain Diff
[MOD] health_insurance
Improved create function to not generate KeyError anymore
parent
22a0f221
Loading
Loading
1 merge request
!31
[MOD] health_insurance
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
models/health_insurance.py
+5
-7
5 additions, 7 deletions
models/health_insurance.py
with
5 additions
and
7 deletions
models/health_insurance.py
+
5
−
7
View file @
a379347f
...
...
@@ -52,13 +52,11 @@ class Partner(models.Model):
@api.model
def
create
(
self
,
vals
):
if
'
partner_type
'
in
vals
:
if
vals
[
'
partner_type
'
]
==
'
insurance
'
:
vals
[
'
ref
'
]
=
str
(
self
.
env
[
'
ir.sequence
'
].
next_by_code
(
'
res.partner.insurance
'
))
if
'
default_partner_type
'
in
self
.
env
.
context
and
not
vals
[
'
ref
'
]:
if
self
.
env
.
context
[
'
default_partner_type
'
]
==
'
insurance
'
:
vals
[
'
ref
'
]
=
str
(
self
.
env
[
'
ir.sequence
'
].
next_by_code
(
'
res.partner.insurance
'
))
return
super
(
Partner
,
self
).
create
(
vals
)
res
=
super
(
Partner
,
self
).
create
(
vals
)
if
not
res
.
ref
:
if
res
.
partner_type
==
'
insurance
'
:
res
.
ref
=
str
(
self
.
env
[
'
ir.sequence
'
].
next_by_code
(
'
res.partner.insurance
'
))
return
res
@api.multi
def
name_get
(
self
):
...
...
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