diff --git a/core/lookups.py b/core/lookups.py index 0ae5ff4c..691cc2f2 100644 --- a/core/lookups.py +++ b/core/lookups.py @@ -66,7 +66,8 @@ class ProductsLookup(RightManagedLookupChannel): model = Product def get_query(self, q, request): - return (self.model.objects.filter(name__icontains=q) | self.model.objects.filter(code__icontains=q))[:50] + return (self.model.objects.filter(name__icontains=q) | + self.model.objects.filter(code__icontains=q)).filter(archived=False)[:50] def format_item_display(self, item): return item.name diff --git a/core/templates/core/user_tools.jinja b/core/templates/core/user_tools.jinja index 9cdc4279..a6f4c6a9 100644 --- a/core/templates/core/user_tools.jinja +++ b/core/templates/core/user_tools.jinja @@ -25,7 +25,7 @@
{% trans %}General management{% endtrans %}
  • {% trans %}General counters management{% endtrans %}
  • {% trans %}Products management{% endtrans %}
  • -
  • {% trans %}Products type management{% endtrans %}
  • +
  • {% trans %}Product types management{% endtrans %}
  • {% endif %} {% for b in settings.SITH_COUNTER_BARS %} {% if user.is_in_group(b[1]+" admin") %} diff --git a/counter/migrations/0007_product_archived.py b/counter/migrations/0007_product_archived.py new file mode 100644 index 00000000..918e3268 --- /dev/null +++ b/counter/migrations/0007_product_archived.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('counter', '0006_auto_20160831_1304'), + ] + + operations = [ + migrations.AddField( + model_name='product', + name='archived', + field=models.BooleanField(verbose_name='archived', default=False), + ), + ] diff --git a/counter/models.py b/counter/models.py index c45cd043..d980aaaa 100644 --- a/counter/models.py +++ b/counter/models.py @@ -89,6 +89,7 @@ class Product(models.Model): parent_product = models.ForeignKey('self', related_name='children_products', verbose_name=_("parent product"), null=True, blank=True, on_delete=models.SET_NULL) buying_groups = models.ManyToManyField(Group, related_name='products', verbose_name=_("buying groups"), blank=True) + archived = models.BooleanField(_("archived"), default=False) class Meta: verbose_name = _('product') @@ -184,7 +185,7 @@ class Counter(models.Model): return bl[random.randrange(0, len(bl))] def is_open(self): - return len(self.get_barmen_list()) > 0: + return len(self.get_barmen_list()) > 0 def barman_list(self): return [b.id for b in self.get_barmen_list()] diff --git a/counter/templates/counter/counter_base.jinja b/counter/templates/counter/counter_base.jinja new file mode 100644 index 00000000..2ac9d2bc --- /dev/null +++ b/counter/templates/counter/counter_base.jinja @@ -0,0 +1,40 @@ +{% extends "core/base.jinja" %} + +{% block content %} +
    +
    {% trans %}Counter administration{% endtrans %}
    +
    + {% trans %}Counters{% endtrans %} + {% trans %}Products{% endtrans %} + {% trans %}Archived products{% endtrans %} + {% trans %}Product types{% endtrans %} + +
    +
    +
    + +
    + {% block admin_content %} + {% endblock %} +
    + +{% endblock %} + + + diff --git a/counter/templates/counter/counter_list.jinja b/counter/templates/counter/counter_list.jinja index 7dc68425..ddf0eab5 100644 --- a/counter/templates/counter/counter_list.jinja +++ b/counter/templates/counter/counter_list.jinja @@ -1,21 +1,46 @@ -{% extends "core/base.jinja" %} +{% extends "counter/counter_base.jinja" %} {% block title %} {% trans %}Counter admin list{% endtrans %} {% endblock %} -{% block content %} +{% block admin_content %}

    {% trans %}New counter{% endtrans %}

    {% if counter_list %}

    {% trans %}Counter admin list{% endtrans %}

    +

    {% trans %}Eboutic{% endtrans %}

    +

    {% trans %}Bars{% endtrans %}

    + +

    {% trans %}Offices{% endtrans %}

    +