Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Sith
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
59
Issues
59
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AE
Sith
Commits
72685618
Commit
72685618
authored
Jan 04, 2017
by
Skia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Many right fix on counters
parent
114272df
Pipeline
#676
passed with stage
in 3 minutes and 13 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
+9
-7
counter/models.py
counter/models.py
+1
-1
counter/views.py
counter/views.py
+2
-2
eboutic/views.py
eboutic/views.py
+6
-4
No files found.
counter/models.py
View file @
72685618
...
...
@@ -161,7 +161,7 @@ class Counter(models.Model):
return
user
.
is_in_group
(
settings
.
SITH_GROUP_COUNTER_ADMIN_ID
)
def
can_be_viewed_by
(
self
,
user
):
if
self
.
type
==
"BAR"
or
self
.
type
==
"EBOUTIC"
:
if
self
.
type
==
"BAR"
:
return
True
return
user
.
is_in_group
(
settings
.
SITH_MAIN_BOARD_GROUP
)
or
user
in
self
.
sellers
.
all
()
...
...
counter/views.py
View file @
72685618
...
...
@@ -90,7 +90,7 @@ class CounterTabsMixin(TabedViewMixin):
})
return
tab_list
class
CounterMain
(
CounterTabsMixin
,
DetailView
,
ProcessFormView
,
FormMixin
):
class
CounterMain
(
CounterTabsMixin
,
CanViewMixin
,
DetailView
,
ProcessFormView
,
FormMixin
):
"""
The public (barman) view
"""
...
...
@@ -148,7 +148,7 @@ class CounterMain(CounterTabsMixin, DetailView, ProcessFormView, FormMixin):
def
get_success_url
(
self
):
return
reverse_lazy
(
'counter:click'
,
args
=
self
.
args
,
kwargs
=
self
.
kwargs
)
class
CounterClick
(
CounterTabsMixin
,
DetailView
):
class
CounterClick
(
CounterTabsMixin
,
CanViewMixin
,
DetailView
):
"""
The click view
This is a detail view not to have to worry about loading the counter
...
...
eboutic/views.py
View file @
72685618
...
...
@@ -15,7 +15,7 @@ from django.db import transaction, DataError
from
django.utils.translation
import
ugettext
as
_
from
django.conf
import
settings
from
counter.models
import
Product
,
Customer
,
Counter
,
ProductType
,
Selling
from
counter.models
import
Customer
,
Counter
,
ProductType
,
Selling
from
eboutic.models
import
Basket
,
Invoice
,
BasketItem
,
InvoiceItem
class
EbouticMain
(
TemplateView
):
...
...
@@ -37,6 +37,7 @@ class EbouticMain(TemplateView):
if
not
request
.
user
.
is_authenticated
():
return
HttpResponseRedirect
(
reverse_lazy
(
'core:login'
,
args
=
self
.
args
,
kwargs
=
kwargs
)
+
"?next="
+
request
.
path
)
self
.
object
=
Counter
.
objects
.
filter
(
type
=
"EBOUTIC"
).
first
()
self
.
make_basket
(
request
)
return
super
(
EbouticMain
,
self
).
get
(
request
,
*
args
,
**
kwargs
)
...
...
@@ -44,6 +45,7 @@ class EbouticMain(TemplateView):
if
not
request
.
user
.
is_authenticated
():
return
HttpResponseRedirect
(
reverse_lazy
(
'core:login'
,
args
=
self
.
args
,
kwargs
=
kwargs
)
+
"?next="
+
request
.
path
)
self
.
object
=
Counter
.
objects
.
filter
(
type
=
"EBOUTIC"
).
first
()
self
.
make_basket
(
request
)
if
'add_product'
in
request
.
POST
[
'action'
]:
self
.
add_product
(
request
)
...
...
@@ -55,7 +57,7 @@ class EbouticMain(TemplateView):
def
add_product
(
self
,
request
):
""" Add a product to the basket """
try
:
p
=
Product
.
obje
cts
.
filter
(
id
=
int
(
request
.
POST
[
'product_id'
])).
first
()
p
=
self
.
object
.
produ
cts
.
filter
(
id
=
int
(
request
.
POST
[
'product_id'
])).
first
()
if
not
p
.
buying_groups
.
exists
():
self
.
basket
.
add_product
(
p
)
for
g
in
p
.
buying_groups
.
all
():
...
...
@@ -68,7 +70,7 @@ class EbouticMain(TemplateView):
def
del_product
(
self
,
request
):
""" Delete a product from the basket """
try
:
p
=
Product
.
obje
cts
.
filter
(
id
=
int
(
request
.
POST
[
'product_id'
])).
first
()
p
=
self
.
object
.
produ
cts
.
filter
(
id
=
int
(
request
.
POST
[
'product_id'
])).
first
()
self
.
basket
.
del_product
(
p
)
except
:
pass
...
...
@@ -144,7 +146,7 @@ class EbouticPayWithSith(TemplateView):
else
:
eboutic
=
Counter
.
objects
.
filter
(
type
=
"EBOUTIC"
).
first
()
for
it
in
b
.
items
.
all
():
product
=
Product
.
obje
cts
.
filter
(
id
=
it
.
product_id
).
first
()
product
=
eboutic
.
produ
cts
.
filter
(
id
=
it
.
product_id
).
first
()
Selling
(
label
=
it
.
product_name
,
counter
=
eboutic
,
...
...
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