remove stock application

This commit is contained in:
thomas girod
2024-09-18 14:49:40 +02:00
committed by imperosol
parent 6f4e93bb76
commit 12bb7e9294
20 changed files with 156 additions and 1467 deletions

View File

@ -33,12 +33,6 @@
<a href="{{ url('counter:admin', counter_id=c.id) }}">{% trans %}Edit{% endtrans %}</a> -
<a href="{{ url('counter:stats', counter_id=c.id) }}">{% trans %}Stats{% endtrans %}</a> -
{% endif %}
{% if c.stock %}
<a href="{{ url('stock:items_list', stock_id=c.stock.id)}}">Stock</a> -
<a href="{{ url('stock:shoppinglist_list', stock_id=c.stock.id)}}">{% trans %}Shopping lists{% endtrans %}</a> -
{% else %}
<a href="{{url('stock:new', counter_id=c.id)}}">{% trans %}Create new stock{% endtrans%}</a> -
{% endif %}
{% if user.is_owner(c) %}
<a href="{{ url('counter:prop_admin', counter_id=c.id) }}">{% trans %}Props{% endtrans %}</a> -
<a href="{{ url('counter:refilling_list', counter_id=c.id) }}">{% trans %}Reloads list{% endtrans %}</a>

View File

@ -126,45 +126,23 @@ class StudentCardDeleteView(DeleteView, CanEditMixin):
class CounterTabsMixin(TabedViewMixin):
def get_tabs_title(self):
if hasattr(self.object, "stock_owner"):
return self.object.stock_owner.counter
else:
return self.object
return self.object
def get_list_of_tabs(self):
tab_list = []
tab_list.append(
tab_list = [
{
"url": reverse_lazy(
"counter:details",
kwargs={
"counter_id": (
self.object.stock_owner.counter.id
if hasattr(self.object, "stock_owner")
else self.object.id
)
},
"counter:details", kwargs={"counter_id": self.object.id}
),
"slug": "counter",
"name": _("Counter"),
}
)
if (
self.object.stock_owner.counter.type
if hasattr(self.object, "stock_owner")
else self.object.type == "BAR"
):
]
if self.object.type == "BAR":
tab_list.append(
{
"url": reverse_lazy(
"counter:cash_summary",
kwargs={
"counter_id": (
self.object.stock_owner.counter.id
if hasattr(self.object, "stock_owner")
else self.object.id
)
},
"counter:cash_summary", kwargs={"counter_id": self.object.id}
),
"slug": "cash_summary",
"name": _("Cash summary"),
@ -173,38 +151,12 @@ class CounterTabsMixin(TabedViewMixin):
tab_list.append(
{
"url": reverse_lazy(
"counter:last_ops",
kwargs={
"counter_id": (
self.object.stock_owner.counter.id
if hasattr(self.object, "stock_owner")
else self.object.id
)
},
"counter:last_ops", kwargs={"counter_id": self.object.id}
),
"slug": "last_ops",
"name": _("Last operations"),
}
)
try:
tab_list.append(
{
"url": reverse_lazy(
"stock:take_items",
kwargs={
"stock_id": (
self.object.stock.id
if hasattr(self.object, "stock")
else self.object.stock_owner.id
)
},
),
"slug": "take_items_from_stock",
"name": _("Take items from stock"),
}
)
except:
pass # The counter just have no stock
return tab_list
@ -721,7 +673,6 @@ def counter_logout(request: HttpRequest, counter_id: int) -> HttpResponseRedirec
class CounterAdminTabsMixin(TabedViewMixin):
tabs_title = _("Counter administration")
list_of_tabs = [
{"url": reverse_lazy("stock:list"), "slug": "stocks", "name": _("Stocks")},
{
"url": reverse_lazy("counter:admin_list"),
"slug": "counters",