Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
AE
Sith
Commits
de4521c1
Commit
de4521c1
authored
Aug 15, 2017
by
Sli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ecocup limit comments
parent
748e3ae3
Pipeline
#1122
passed with stage
in 4 minutes and 17 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
counter/models.py
counter/models.py
+8
-0
sith/settings.py
sith/settings.py
+1
-0
No files found.
counter/models.py
View file @
de4521c1
...
...
@@ -81,6 +81,11 @@ class Customer(models.Model):
return
number
+
letter
def
save
(
self
,
allow_negative
=
False
,
is_selling
=
False
,
*
args
,
**
kwargs
):
"""
is_selling : tell if the current action is a selling
allow_negative : ignored if not a selling. Allow a selling to put the account in negative
Those two parameters avoid blocking the save method of a customer if his account is negative
"""
if
self
.
amount
<
0
and
(
is_selling
and
not
allow_negative
):
raise
ValidationError
(
_
(
"Not enough money"
))
super
(
Customer
,
self
).
save
(
*
args
,
**
kwargs
)
...
...
@@ -393,6 +398,9 @@ class Selling(models.Model):
)
def
save
(
self
,
allow_negative
=
False
,
*
args
,
**
kwargs
):
"""
allow_negative : Allow this selling to use more money than available for this user
"""
if
not
self
.
date
:
self
.
date
=
timezone
.
now
()
self
.
full_clean
()
...
...
sith/settings.py
View file @
de4521c1
...
...
@@ -401,6 +401,7 @@ SITH_ECOCUP_CONS = 1152
SITH_ECOCUP_DECO
=
1151
# The limit is the maximum difference between cons and deco possible for a customer
SITH_ECOCUP_LIMIT
=
3
# Defines pagination for cash summary
...
...
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