Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
AE
Sith
Commits
2ef3c026
Commit
2ef3c026
authored
May 06, 2017
by
Sli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error on accounting when no target_type specified
parent
7cb9ea40
Pipeline
#939
passed with stage
in 4 minutes and 19 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
accounting/views.py
accounting/views.py
+9
-8
No files found.
accounting/views.py
View file @
2ef3c026
...
...
@@ -304,14 +304,15 @@ class OperationForm(forms.ModelForm):
def
clean
(
self
):
self
.
cleaned_data
=
super
(
OperationForm
,
self
).
clean
()
if
self
.
cleaned_data
[
'target_type'
]
==
"USER"
:
self
.
cleaned_data
[
'target_id'
]
=
self
.
cleaned_data
[
'user'
].
id
elif
self
.
cleaned_data
[
'target_type'
]
==
"ACCOUNT"
:
self
.
cleaned_data
[
'target_id'
]
=
self
.
cleaned_data
[
'club_account'
].
id
elif
self
.
cleaned_data
[
'target_type'
]
==
"CLUB"
:
self
.
cleaned_data
[
'target_id'
]
=
self
.
cleaned_data
[
'club'
].
id
elif
self
.
cleaned_data
[
'target_type'
]
==
"COMPANY"
:
self
.
cleaned_data
[
'target_id'
]
=
self
.
cleaned_data
[
'company'
].
id
if
'target_type'
in
self
.
cleaned_data
.
keys
():
if
self
.
cleaned_data
[
'target_type'
]
==
"USER"
:
self
.
cleaned_data
[
'target_id'
]
=
self
.
cleaned_data
[
'user'
].
id
elif
self
.
cleaned_data
[
'target_type'
]
==
"ACCOUNT"
:
self
.
cleaned_data
[
'target_id'
]
=
self
.
cleaned_data
[
'club_account'
].
id
elif
self
.
cleaned_data
[
'target_type'
]
==
"CLUB"
:
self
.
cleaned_data
[
'target_id'
]
=
self
.
cleaned_data
[
'club'
].
id
elif
self
.
cleaned_data
[
'target_type'
]
==
"COMPANY"
:
self
.
cleaned_data
[
'target_id'
]
=
self
.
cleaned_data
[
'company'
].
id
return
self
.
cleaned_data
def
save
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment