Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AE UTBM
Sith
Commits
4e6b5929
Commit
4e6b5929
authored
Jul 26, 2016
by
Skia
🤘
Browse files
Fix eboutic
parent
45f5a58b
Pipeline
#71
failed with stage
in 1 minute and 25 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
core/templates/core/user_base.jinja
View file @
4e6b5929
...
...
@@ -10,7 +10,7 @@
{%
if
can_edit_prop
(
profile
,
request.user
)
%}
<a
href=
"
{{
url
(
'core:user_groups'
,
user_id
=
profile.id
)
}}
"
>
{%
trans
%}
Groups
{%
endtrans
%}
</a>
{%
endif
%}
{%
if
(
profile
==
request.user
{%
if
profile.customer
and
(
profile
==
request.user
or
request.user.is_in_group
(
settings.SITH_GROUPS
[
'accounting-admin'
][
'name'
])
or
request.user.is_in_group
(
settings.SITH_GROUPS
[
'root'
][
'name'
]))
%}
<a
href=
"
{{
url
(
'core:user_account'
,
user_id
=
profile.id
)
}}
"
>
{%
trans
%}
Account
{%
endtrans
%}
</a>
...
...
eboutic/models.py
View file @
4e6b5929
...
...
@@ -2,7 +2,7 @@ from django.db import models, DataError
from
django.utils.translation
import
ugettext_lazy
as
_
from
accounting.models
import
CurrencyField
from
counter.models
import
Counter
,
Product
from
counter.models
import
Counter
,
Product
,
Customer
from
core.models
import
User
class
Basket
(
models
.
Model
):
...
...
@@ -57,6 +57,9 @@ class Invoice(models.Model):
def
validate
(
self
,
*
args
,
**
kwargs
):
if
self
.
validated
:
raise
DataError
(
_
(
"Invoice already validated"
))
from
counter.models
import
Customer
if
not
Customer
.
objects
.
filter
(
user
=
self
.
user
).
exists
():
Customer
(
user
=
self
.
user
,
account_id
=
Customer
.
generate_account_id
(),
amount
=
0
).
save
()
if
self
.
payment_method
==
"SITH_ACCOUNT"
:
self
.
user
.
customer
.
amount
-=
self
.
get_total
()
self
.
user
.
customer
.
save
()
...
...
Write
Preview
Supports
Markdown
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