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
0ecb78a1
Commit
0ecb78a1
authored
Jul 22, 2016
by
Skia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some counter stuff
parent
256651f5
Pipeline
#66
failed with stage
in 1 minute and 12 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
79 additions
and
71 deletions
+79
-71
counter/models.py
counter/models.py
+2
-0
counter/templates/counter/counter_list.jinja
counter/templates/counter/counter_list.jinja
+5
-0
counter/templates/counter/counter_main.jinja
counter/templates/counter/counter_main.jinja
+1
-5
counter/views.py
counter/views.py
+13
-13
eboutic/models.py
eboutic/models.py
+0
-4
eboutic/views.py
eboutic/views.py
+3
-4
locale/fr/LC_MESSAGES/django.mo
locale/fr/LC_MESSAGES/django.mo
+0
-0
locale/fr/LC_MESSAGES/django.po
locale/fr/LC_MESSAGES/django.po
+55
-45
No files found.
counter/models.py
View file @
0ecb78a1
...
...
@@ -95,6 +95,8 @@ class Counter(models.Model):
return
self
.
name
def
get_absolute_url
(
self
):
if
self
.
type
==
"EBOUTIC"
:
return
reverse
(
'eboutic:main'
)
return
reverse
(
'counter:details'
,
kwargs
=
{
'counter_id'
:
self
.
id
})
def
can_be_edited_by
(
self
,
user
):
...
...
counter/templates/counter/counter_list.jinja
View file @
0ecb78a1
...
...
@@ -10,8 +10,13 @@
<h3>
{%
trans
%}
Counter admin list
{%
endtrans
%}
</h3>
<ul>
{%
for
c
in
counter_list
%}
{%
if
c.type
==
"EBOUTIC"
%}
<li><a
href=
"
{{
url
(
'eboutic:main'
)
}}
"
>
{{
c
}}
</a>
-
<a
href=
"
{{
url
(
'counter:admin'
,
counter_id
=
c.id
)
}}
"
>
{%
trans
%}
Edit
{%
endtrans
%}
</a></li>
{%
else
%}
<li><a
href=
"
{{
url
(
'counter:details'
,
counter_id
=
c.id
)
}}
"
>
{{
c
}}
</a>
-
<a
href=
"
{{
url
(
'counter:admin'
,
counter_id
=
c.id
)
}}
"
>
{%
trans
%}
Edit
{%
endtrans
%}
</a></li>
{%
endif
%}
{%
endfor
%}
</ul>
{%
else
%}
...
...
counter/templates/counter/counter_main.jinja
View file @
0ecb78a1
...
...
@@ -9,11 +9,7 @@
{%
endmacro
%}
{%
block
content
%}
<h3>
{%
trans
%}
Counter
{%
endtrans
%}
</h3>
<h4>
{{
counter
}}
</h4>
<p><strong>
{%
trans
%}
Club:
{%
endtrans
%}
</strong>
{{
counter.club
}}
</p>
<p><strong>
{%
trans
%}
Products:
{%
endtrans
%}
</strong>
{{
counter.products.all
()
}}
</p>
<h3>
{%
trans
counter_name
=
counter
%}{{
counter_name
}}
counter
{%
endtrans
%}
</h3>
<div>
<h3>
{%
trans
%}
Sellings
{%
endtrans
%}
</h3>
...
...
counter/views.py
View file @
0ecb78a1
...
...
@@ -124,12 +124,20 @@ class CounterClick(DetailView):
self
.
object
=
self
.
get_object
()
self
.
customer
=
Customer
.
objects
.
filter
(
user__id
=
self
.
kwargs
[
'user_id'
]).
first
()
self
.
refill_form
=
None
if
len
(
Counter
.
get_barmen_list
(
self
.
object
.
id
))
<
1
:
# Check that at least one barman is logged in
if
((
self
.
object
.
type
!=
"BAR"
and
not
request
.
user
.
is_authenticated
())
or
(
self
.
object
.
type
==
"BAR"
and
len
(
Counter
.
get_barmen_list
(
self
.
object
.
id
))
<
1
)):
# Check that at least one barman is logged in
return
self
.
cancel
(
request
)
if
'basket'
not
in
request
.
session
.
keys
():
request
.
session
[
'basket'
]
=
{}
request
.
session
[
'basket_total'
]
=
0
request
.
session
[
'not_enough'
]
=
False
if
self
.
object
.
type
!=
"BAR"
:
self
.
operator
=
request
.
user
elif
self
.
is_barman_price
():
self
.
operator
=
self
.
customer
.
user
else
:
self
.
operator
=
Counter
.
get_random_barman
(
self
.
object
.
id
)
if
'add_product'
in
request
.
POST
[
'action'
]:
self
.
add_product
(
request
)
...
...
@@ -147,7 +155,7 @@ class CounterClick(DetailView):
return
self
.
render_to_response
(
context
)
def
is_barman_price
(
self
):
if
self
.
customer
.
user
.
id
in
[
s
.
id
for
s
in
Counter
.
get_barmen_list
(
self
.
object
.
id
)]:
if
self
.
object
.
type
==
"BAR"
and
self
.
customer
.
user
.
id
in
[
s
.
id
for
s
in
Counter
.
get_barmen_list
(
self
.
object
.
id
)]:
return
True
else
:
return
False
...
...
@@ -210,7 +218,7 @@ class CounterClick(DetailView):
nb
=
1
else
:
nb
=
int
(
nb
)
p
=
Product
.
obje
cts
.
filter
(
code
=
code
).
first
()
p
=
self
.
object
.
produ
cts
.
filter
(
code
=
code
).
first
()
if
p
is
not
None
:
while
nb
>
0
and
not
self
.
add_product
(
request
,
nb
,
p
.
id
):
nb
-=
1
...
...
@@ -220,10 +228,6 @@ class CounterClick(DetailView):
def
finish
(
self
,
request
):
""" Finish the click session, and validate the basket """
with
transaction
.
atomic
():
if
self
.
is_barman_price
():
seller
=
self
.
customer
.
user
else
:
seller
=
Counter
.
get_random_barman
(
self
.
object
.
id
)
request
.
session
[
'last_basket'
]
=
[]
for
pid
,
infos
in
request
.
session
[
'basket'
].
items
():
# This duplicates code for DB optimization (prevent to load many times the same object)
...
...
@@ -236,7 +240,7 @@ class CounterClick(DetailView):
raise
DataError
(
_
(
"You have not enough money to buy all the basket"
))
request
.
session
[
'last_basket'
].
append
(
"%d x %s"
%
(
infos
[
'qty'
],
p
.
name
))
s
=
Selling
(
product
=
p
,
counter
=
self
.
object
,
unit_price
=
uprice
,
quantity
=
infos
[
'qty'
],
seller
=
sel
le
r
,
customer
=
self
.
customer
)
quantity
=
infos
[
'qty'
],
seller
=
sel
f
.
operato
r
,
customer
=
self
.
customer
)
s
.
save
()
request
.
session
[
'last_customer'
]
=
self
.
customer
.
user
.
get_display_name
()
request
.
session
[
'last_total'
]
=
"%0.2f"
%
self
.
sum_basket
(
request
)
...
...
@@ -256,14 +260,10 @@ class CounterClick(DetailView):
def
refill
(
self
,
request
):
"""Refill the customer's account"""
if
self
.
is_barman_price
():
operator
=
self
.
customer
.
user
else
:
operator
=
Counter
.
get_random_barman
(
self
.
object
.
id
)
form
=
RefillForm
(
request
.
POST
)
if
form
.
is_valid
():
form
.
instance
.
counter
=
self
.
object
form
.
instance
.
operator
=
operator
form
.
instance
.
operator
=
self
.
operator
form
.
instance
.
customer
=
self
.
customer
form
.
instance
.
save
()
else
:
...
...
eboutic/models.py
View file @
0ecb78a1
...
...
@@ -5,10 +5,6 @@ from accounting.models import CurrencyField
from
counter.models
import
Counter
,
Product
from
core.models
import
User
class
Eboutic
(
Counter
):
class
Meta
:
proxy
=
True
class
Basket
(
models
.
Model
):
"""
Basket is built when the user validate its session basket and asks for payment
...
...
eboutic/views.py
View file @
0ecb78a1
from
django.shortcuts
import
render
from
django.core.urlresolvers
import
reverse_lazy
from
eboutic.models
import
Eboutic
from
django.views.generic
import
TemplateView
,
View
from
django.http
import
HttpResponse
,
HttpResponseRedirect
from
django.shortcuts
import
render
from
django.db
import
transaction
,
DataError
from
django.utils.translation
import
ugettext
as
_
from
counter.models
import
Product
,
Customer
from
eboutic.models
import
Basket
,
Invoice
,
Eboutic
,
BasketItem
,
InvoiceItem
from
counter.models
import
Product
,
Customer
,
Counter
from
eboutic.models
import
Basket
,
Invoice
,
BasketItem
,
InvoiceItem
# Create your views here.
class
EbouticMain
(
TemplateView
):
...
...
@@ -69,7 +68,7 @@ class EbouticMain(TemplateView):
def
get_context_data
(
self
,
**
kwargs
):
kwargs
=
super
(
EbouticMain
,
self
).
get_context_data
(
**
kwargs
)
kwargs
[
'basket_total'
]
=
EbouticMain
.
sum_basket
(
self
.
request
)
kwargs
[
'eboutic'
]
=
Eboutic
.
objects
.
filter
(
type
=
"EBOUTIC"
).
first
()
kwargs
[
'eboutic'
]
=
Counter
.
objects
.
filter
(
type
=
"EBOUTIC"
).
first
()
return
kwargs
class
EbouticCommand
(
TemplateView
):
...
...
locale/fr/LC_MESSAGES/django.mo
View file @
0ecb78a1
No preview for this file type
locale/fr/LC_MESSAGES/django.po
View file @
0ecb78a1
...
...
@@ -6,7 +6,7 @@
msgid
""
msgstr
""
"Report-Msgid-Bugs-To:
\n
"
"POT-Creation-Date: 2016-07-22
01:47
+0200
\n
"
"POT-Creation-Date: 2016-07-22
13:32
+0200
\n
"
"PO-Revision-Date: 2016-07-18
\n
"
"Last-Translator: Skia <skia@libskia.so>
\n
"
"Language-Team: AE info <ae.info@utbm.fr>
\n
"
...
...
@@ -30,11 +30,11 @@ msgstr "IBAN"
msgid
"account number"
msgstr
"numero de compte"
#: accounting/models.py:92 club/models.py:109 counter/models.py:21
4
#: accounting/models.py:92 club/models.py:109 counter/models.py:21
6
msgid
"start date"
msgstr
"date de début"
#: accounting/models.py:93 club/models.py:110 counter/models.py:21
5
#: accounting/models.py:93 club/models.py:110 counter/models.py:21
7
msgid
"end date"
msgstr
"date de fin"
...
...
@@ -43,7 +43,7 @@ msgid "is closed"
msgstr
"est fermé"
#: accounting/models.py:97 accounting/models.py:136 counter/models.py:21
#: counter/models.py:16
2
#: counter/models.py:16
4
msgid
"amount"
msgstr
"montant"
...
...
@@ -55,8 +55,8 @@ msgstr "montant effectif"
msgid
"number"
msgstr
"numéro"
#: accounting/models.py:137 core/models.py:462 counter/models.py:16
5
#: counter/models.py:19
3
eboutic/models.py:1
7
eboutic/models.py:
30
#: accounting/models.py:137 core/models.py:462 counter/models.py:16
7
#: counter/models.py:19
5
eboutic/models.py:1
3
eboutic/models.py:
26
msgid
"date"
msgstr
"date"
...
...
@@ -68,7 +68,7 @@ msgstr "intitulé"
msgid
"remark"
msgstr
"remarque"
#: accounting/models.py:140 counter/models.py:16
6
eboutic/models.py:
3
2
#: accounting/models.py:140 counter/models.py:16
8
eboutic/models.py:2
8
#: subscription/models.py:34
msgid
"payment method"
msgstr
"méthode de paiement"
...
...
@@ -144,10 +144,11 @@ msgstr "Nouveau compte club"
#: accounting/templates/accounting/bank_account_list.jinja:15
#: accounting/templates/accounting/club_account_details.jinja:44
#: accounting/templates/accounting/journal_details.jinja:51
#: club/templates/club/club_detail.jinja:7 core/templates/core/page.jinja:3
0
#: club/templates/club/club_detail.jinja:7 core/templates/core/page.jinja:3
1
#: core/templates/core/user_base.jinja:8
#: core/templates/core/user_tools.jinja:30
#: counter/templates/counter/counter_list.jinja:14
#: counter/templates/counter/counter_list.jinja:15
#: counter/templates/counter/counter_list.jinja:18
msgid
"Edit"
msgstr
"Éditer"
...
...
@@ -227,7 +228,7 @@ msgid "No"
msgstr
"Non"
#: accounting/templates/accounting/club_account_details.jinja:43
#: core/templates/core/page.jinja:2
7
#: core/templates/core/page.jinja:2
8
msgid
"View"
msgstr
"Voir"
...
...
@@ -304,7 +305,7 @@ msgstr "Adresse"
msgid
"You can not make loops in clubs"
msgstr
"Vous ne pouvez pas faire de boucles dans les clubs"
#: club/models.py:107 eboutic/models.py:1
6
eboutic/models.py:2
9
#: club/models.py:107 eboutic/models.py:1
2
eboutic/models.py:2
5
msgid
"user"
msgstr
"nom d'utilisateur"
...
...
@@ -342,7 +343,7 @@ msgstr "Club"
msgid
"Back to list"
msgstr
"Retour à la liste"
#: club/templates/club/club_detail.jinja:10 core/templates/core/page.jinja:3
3
#: club/templates/club/club_detail.jinja:10 core/templates/core/page.jinja:3
4
msgid
"Prop"
msgstr
"Propriétés"
...
...
@@ -545,14 +546,18 @@ msgid "Users"
msgstr
"Utilisateurs"
#: core/templates/core/base.jinja:30
msgid
"Wiki"
msgstr
""
#: core/templates/core/base.jinja:31
msgid
"Pages"
msgstr
"Pages"
#: core/templates/core/base.jinja:3
1
#: core/templates/core/base.jinja:3
2
msgid
"Clubs"
msgstr
"Clubs"
#: core/templates/core/base.jinja:4
4
#: core/templates/core/base.jinja:4
5
msgid
"Site made by good people"
msgstr
"Site réalisé par des gens biens"
...
...
@@ -624,7 +629,7 @@ msgid "Please login to see this page."
msgstr
"Merci de vous identifier pour voir cette page."
#: core/templates/core/login.jinja:31
#: counter/templates/counter/counter_main.jinja:
52
#: counter/templates/counter/counter_main.jinja:
48
msgid
"login"
msgstr
"login"
...
...
@@ -645,15 +650,15 @@ msgstr "Créer une page"
msgid
"Not found"
msgstr
"Non trouvé"
#: core/templates/core/page.jinja:2
8
#: core/templates/core/page.jinja:2
9
msgid
"History"
msgstr
"Historique"
#: core/templates/core/page.jinja:4
3
#: core/templates/core/page.jinja:4
5
msgid
"Page does not exist"
msgstr
"La page n'existe pas."
#: core/templates/core/page.jinja:4
5
#: core/templates/core/page.jinja:4
7
msgid
"Create it?"
msgstr
"La créer ?"
...
...
@@ -669,6 +674,7 @@ msgid "Page history"
msgstr
"Historique de la page"
#: core/templates/core/page_hist.jinja:5
#, python-format
msgid
"You're seeing the history of page
\"
%(page_name)s
\"
"
msgstr
"Vous consultez l'historique de la page
\"
%(page_name)s
\"
"
...
...
@@ -911,25 +917,23 @@ msgstr "Bureau"
msgid
"Eboutic"
msgstr
"Eboutic"
#: counter/models.py:1
68
#: counter/models.py:1
70
msgid
"bank"
msgstr
"banque"
#: counter/models.py:1
8
9 eboutic/models.py:5
5
#: counter/models.py:19
1
eboutic/models.py:5
1
msgid
"unit price"
msgstr
"prix unitaire"
#: counter/models.py:19
0
eboutic/models.py:5
6
#: counter/models.py:19
2
eboutic/models.py:5
2
msgid
"quantity"
msgstr
"quantité"
#: counter/templates/counter/counter_click.jinja:20
#: counter/templates/counter/counter_main.jinja:12
msgid
"Counter"
msgstr
"Comptoir"
#: counter/templates/counter/counter_click.jinja:22
#: counter/templates/counter/counter_main.jinja:14
msgid
"Club: "
msgstr
"Club : "
...
...
@@ -961,7 +965,7 @@ msgid "Basket: "
msgstr
"Panier : "
#: counter/templates/counter/counter_click.jinja:58
#: counter/templates/counter/counter_main.jinja:2
8
#: counter/templates/counter/counter_main.jinja:2
4
#: eboutic/templates/eboutic/eboutic_main.jinja:31
msgid
"Total: "
msgstr
"Total : "
...
...
@@ -971,7 +975,6 @@ msgid "Finish"
msgstr
"Terminer"
#: counter/templates/counter/counter_click.jinja:69
#: counter/templates/counter/counter_main.jinja:15
#: eboutic/templates/eboutic/eboutic_main.jinja:39
msgid
"Products: "
msgstr
"Produits : "
...
...
@@ -989,39 +992,43 @@ msgstr "Liste des comptoirs"
msgid
"New counter"
msgstr
"Nouveau comptoir"
#: counter/templates/counter/counter_list.jinja:
18
#: counter/templates/counter/counter_list.jinja:
23
msgid
"There is no counters in this website."
msgstr
"Il n'y a pas de comptoirs dans ce site web."
#: counter/templates/counter/counter_main.jinja:19
#: counter/templates/counter/counter_main.jinja:12
msgid
"%(counter_name)s counter"
msgstr
"Comptoir %(counter_name)s"
#: counter/templates/counter/counter_main.jinja:15
msgid
"Sellings"
msgstr
"Ventes"
#: counter/templates/counter/counter_main.jinja:
2
1
#: counter/templates/counter/counter_main.jinja:1
7
msgid
"Last selling: "
msgstr
"Dernière vente : "
#: counter/templates/counter/counter_main.jinja:
22
#: counter/templates/counter/counter_main.jinja:
18
msgid
"Client: "
msgstr
"Client : "
#: counter/templates/counter/counter_main.jinja:
22
#: counter/templates/counter/counter_main.jinja:
18
msgid
"New amount: "
msgstr
"Nouveau montant : "
#: counter/templates/counter/counter_main.jinja:
31
#: counter/templates/counter/counter_main.jinja:
27
msgid
"Enter client code:"
msgstr
"Entrez un code client : "
#: counter/templates/counter/counter_main.jinja:3
5
#: counter/templates/counter/counter_main.jinja:3
1
msgid
"validate"
msgstr
"valider"
#: counter/templates/counter/counter_main.jinja:3
8
#: counter/templates/counter/counter_main.jinja:3
4
msgid
"Please, login"
msgstr
"Merci de vous identifier"
#: counter/templates/counter/counter_main.jinja:
4
3
#: counter/templates/counter/counter_main.jinja:3
9
msgid
"Barman: "
msgstr
"Barman : "
...
...
@@ -1034,43 +1041,43 @@ msgstr "Compte de %(user_name)s"
msgid
"User account"
msgstr
"Compte utilisateur"
#: counter/views.py:20
0
#: counter/views.py:20
8
msgid
"END"
msgstr
"FIN"
#: counter/views.py:20
2
#: counter/views.py:2
1
0
msgid
"CAN"
msgstr
"ANN"
#: counter/views.py:2
36
#: counter/views.py:2
40
msgid
"You have not enough money to buy all the basket"
msgstr
"Vous n'avez pas assez d'argent pour acheter le panier"
#: eboutic/models.py:
31
sith/settings.py:231 sith/settings_sample.py:231
#: eboutic/models.py:
27
sith/settings.py:231 sith/settings_sample.py:231
msgid
"Credit card"
msgstr
"Carte banquaire"
#: eboutic/models.py:
31
#: eboutic/models.py:
27
msgid
"Sith account"
msgstr
"Compte utilisateur"
#: eboutic/models.py:
33
#: eboutic/models.py:
29
msgid
"validated"
msgstr
"validé"
#: eboutic/models.py:4
4
#: eboutic/models.py:4
0
msgid
"Invoice already validated"
msgstr
"Facture déjà validée"
#: eboutic/models.py:5
4
#: eboutic/models.py:5
0
msgid
"product name"
msgstr
"nom du produit"
#: eboutic/models.py:6
5
#: eboutic/models.py:6
1
msgid
"basket"
msgstr
"panier"
#: eboutic/models.py:6
8
#: eboutic/models.py:6
4
msgid
"invoice"
msgstr
"facture"
...
...
@@ -1094,7 +1101,7 @@ msgstr "Le paiement a échoué"
msgid
"Payment successful"
msgstr
"Le paiement a été effectué"
#: eboutic/views.py:11
7
#: eboutic/views.py:11
6
msgid
"You have not enough money to buy the basket"
msgstr
"Vous n'avez pas assez d'argent pour acheter le panier"
...
...
@@ -1203,6 +1210,9 @@ msgid "You must either choose an existing user or create a new one properly"
msgstr
""
"Vous devez soit choisir un utilisateur existant, ou en créer un proprement."
#~ msgid "%(c)s counter"
#~ msgstr "Comptoir %(c)s"
#~ msgid "Page"
#~ msgstr "Page"
...
...
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