mirror of
https://github.com/ae-utbm/sith.git
synced 2025-10-20 03:38:28 +00:00
Compare commits
2 Commits
pinktober
...
club_api_f
Author | SHA1 | Date | |
---|---|---|---|
|
0a5f589c2d | ||
|
55cd6d4916 |
14
club/api.py
14
club/api.py
@@ -1,7 +1,5 @@
|
||||
from typing import Annotated
|
||||
|
||||
from annotated_types import MinLen
|
||||
from django.db.models import Prefetch
|
||||
from ninja import Query
|
||||
from ninja.security import SessionAuth
|
||||
from ninja_extra import ControllerBase, api_controller, paginate, route
|
||||
from ninja_extra.pagination import PageNumberPaginationExtra
|
||||
@@ -10,7 +8,7 @@ from ninja_extra.schemas import PaginatedResponseSchema
|
||||
from api.auth import ApiKeyAuth
|
||||
from api.permissions import CanAccessLookup, HasPerm
|
||||
from club.models import Club, Membership
|
||||
from club.schemas import ClubSchema, SimpleClubSchema
|
||||
from club.schemas import ClubSchema, ClubSearchFilterSchema, SimpleClubSchema
|
||||
|
||||
|
||||
@api_controller("/club")
|
||||
@@ -23,8 +21,12 @@ class ClubController(ControllerBase):
|
||||
url_name="search_club",
|
||||
)
|
||||
@paginate(PageNumberPaginationExtra, page_size=50)
|
||||
def search_club(self, search: Annotated[str, MinLen(1)]):
|
||||
return Club.objects.filter(name__icontains=search).values()
|
||||
def search_club(
|
||||
self,
|
||||
filters: Query[ClubSearchFilterSchema],
|
||||
):
|
||||
clubs = Club.objects.all()
|
||||
return filters.filter(clubs)
|
||||
|
||||
@route.get(
|
||||
"/{int:club_id}",
|
||||
|
@@ -1,9 +1,24 @@
|
||||
from ninja import ModelSchema
|
||||
from typing import Optional
|
||||
|
||||
from django.db.models import Q
|
||||
from ninja import Field, FilterSchema, ModelSchema
|
||||
|
||||
from club.models import Club, Membership
|
||||
from core.schemas import SimpleUserSchema
|
||||
|
||||
|
||||
class ClubSearchFilterSchema(FilterSchema):
|
||||
search: Optional[str] = Field(None, q="name__icontains")
|
||||
club_id: Optional[int] = Field(None, q="id")
|
||||
is_active: Optional[bool] = None
|
||||
parent_id: Optional[int] = None
|
||||
parent_name: Optional[str] = Field(None, q="parent__name__icontains")
|
||||
exclude_ids: Optional[list[int]] = None
|
||||
|
||||
def filter_exclude_ids(self, value: list[int]):
|
||||
return ~Q(id__in=value)
|
||||
|
||||
|
||||
class SimpleClubSchema(ModelSchema):
|
||||
class Meta:
|
||||
model = Club
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { alpinePlugin as notificationPlugin } from "#core:utils/notifications";
|
||||
import { alpinePlugin } from "#core:utils/notifications";
|
||||
import sort from "@alpinejs/sort";
|
||||
import Alpine from "alpinejs";
|
||||
|
||||
Alpine.plugin(sort);
|
||||
Alpine.magic("notifications", notificationPlugin);
|
||||
Alpine.magic("notifications", alpinePlugin);
|
||||
window.Alpine = Alpine;
|
||||
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
|
@@ -503,10 +503,6 @@ th {
|
||||
text-align: center;
|
||||
padding: 5px 10px;
|
||||
|
||||
>input[type="checkbox"] {
|
||||
padding: unset;
|
||||
}
|
||||
|
||||
>ul {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
@@ -13,10 +13,10 @@
|
||||
}"
|
||||
@quick-notification-add="(e) => messages.push(e?.detail)"
|
||||
@quick-notification-delete="messages = []">
|
||||
<template x-for="(message, index) in messages">
|
||||
<div class="alert" :class="`alert-${message.tag}`" x-transition>
|
||||
<template x-for="message in messages">
|
||||
<div x-data="{show: true}" class="alert" :class="`alert-${message.tag}`" x-show="show" x-transition>
|
||||
<span class="alert-main" x-text="message.text"></span>
|
||||
<span class="clickable" @click="messages = messages.filter((item, i) => i !== index)">
|
||||
<span class="clickable" @click="show = false">
|
||||
<i class="fa fa-close"></i>
|
||||
</span>
|
||||
</div>
|
||||
|
@@ -245,26 +245,3 @@
|
||||
<button type="button" onclick="checkbox_{{form_id}}(true);">{% trans %}Select All{% endtrans %}</button>
|
||||
<button type="button" onclick="checkbox_{{form_id}}(false);">{% trans %}Unselect All{% endtrans %}</button>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro update_notifications(messages, clear) %}
|
||||
{# Update notification area from new messages sent by django backend
|
||||
This is useful when performing fragment swaps to keep messages up to date
|
||||
Without this, the fragment would need to take control of the notification area and
|
||||
this would be an issue when having more than one fragment
|
||||
|
||||
Parameters:
|
||||
messages: messages from django.contrib
|
||||
clear : optional boolean that controls if notifications should be cleared first. True is the default
|
||||
#}
|
||||
{% set clear = clear|default(true) %}
|
||||
{% if messages %}
|
||||
<div x-init="() => {
|
||||
{% if clear %}
|
||||
$notifications.clear()
|
||||
{% endif %}
|
||||
{% for message in messages %}
|
||||
$notifications.{{ message.tags }}('{{ message }}')
|
||||
{% endfor %}
|
||||
}"></div>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
@@ -22,7 +22,6 @@ from counter.models import (
|
||||
Counter,
|
||||
Customer,
|
||||
Eticket,
|
||||
InvoiceCall,
|
||||
Permanency,
|
||||
Product,
|
||||
ProductType,
|
||||
@@ -161,11 +160,3 @@ class CashRegisterSummaryAdmin(SearchModelAdmin):
|
||||
class EticketAdmin(SearchModelAdmin):
|
||||
list_display = ("product", "event_date", "event_title")
|
||||
search_fields = ("product__name", "event_title")
|
||||
|
||||
|
||||
@admin.register(InvoiceCall)
|
||||
class InvoiceCallAdmin(SearchModelAdmin):
|
||||
list_display = ("club", "month", "is_validated")
|
||||
search_fields = ("club__name",)
|
||||
list_filter = (("club", admin.RelatedOnlyFieldListFilter),)
|
||||
date_hierarchy = "month"
|
||||
|
@@ -1,18 +1,15 @@
|
||||
import json
|
||||
import math
|
||||
import uuid
|
||||
from datetime import date
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from django import forms
|
||||
from django.db.models import Exists, OuterRef, Q
|
||||
from django.db.models import Q
|
||||
from django.forms import BaseModelFormSet
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django_celery_beat.models import ClockedSchedule
|
||||
from phonenumber_field.widgets import RegionalPhoneNumberWidget
|
||||
|
||||
from club.models import Club
|
||||
from club.widgets.ajax_select import AutoCompleteSelectClub
|
||||
from core.models import User
|
||||
from core.views.forms import (
|
||||
@@ -32,12 +29,10 @@ from counter.models import (
|
||||
Counter,
|
||||
Customer,
|
||||
Eticket,
|
||||
InvoiceCall,
|
||||
Product,
|
||||
Refilling,
|
||||
ReturnableProduct,
|
||||
ScheduledProductAction,
|
||||
Selling,
|
||||
StudentCard,
|
||||
get_product_actions,
|
||||
)
|
||||
@@ -483,48 +478,3 @@ class BaseBasketForm(forms.BaseFormSet):
|
||||
BasketForm = forms.formset_factory(
|
||||
BasketProductForm, formset=BaseBasketForm, absolute_max=None, min_num=1
|
||||
)
|
||||
|
||||
|
||||
class InvoiceCallForm(forms.Form):
|
||||
def __init__(self, *args, month: date, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.month = month
|
||||
self.clubs = list(
|
||||
Club.objects.filter(
|
||||
Exists(
|
||||
Selling.objects.filter(
|
||||
club=OuterRef("pk"),
|
||||
date__gte=month,
|
||||
date__lte=month + relativedelta(months=1),
|
||||
)
|
||||
)
|
||||
).annotate(
|
||||
validated_invoice=Exists(
|
||||
InvoiceCall.objects.filter(
|
||||
club=OuterRef("pk"), month=month, is_validated=True
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
self.fields = {
|
||||
str(club.id): forms.BooleanField(
|
||||
required=False, initial=club.validated_invoice
|
||||
)
|
||||
for club in self.clubs
|
||||
}
|
||||
|
||||
def save(self):
|
||||
invoice_calls = [
|
||||
InvoiceCall(
|
||||
month=self.month,
|
||||
club_id=club.id,
|
||||
is_validated=self.cleaned_data.get(str(club.id), False),
|
||||
)
|
||||
for club in self.clubs
|
||||
]
|
||||
InvoiceCall.objects.bulk_create(
|
||||
invoice_calls,
|
||||
update_conflicts=True,
|
||||
update_fields=["is_validated"],
|
||||
unique_fields=["month", "club"],
|
||||
)
|
||||
|
@@ -1,51 +0,0 @@
|
||||
# Generated by Django 5.2.3 on 2025-10-15 21:54
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
import counter.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("club", "0014_alter_club_options_rename_unix_name_club_slug_name_and_more"),
|
||||
("counter", "0032_scheduledproductaction"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="InvoiceCall",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.AutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
(
|
||||
"is_validated",
|
||||
models.BooleanField(default=False, verbose_name="is validated"),
|
||||
),
|
||||
("month", counter.models.MonthField(verbose_name="invoice date")),
|
||||
(
|
||||
"club",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE, to="club.club"
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Invoice call",
|
||||
"verbose_name_plural": "Invoice calls",
|
||||
"constraints": [
|
||||
models.UniqueConstraint(
|
||||
fields=("club", "month"),
|
||||
name="counter_invoicecall_unique_club_month",
|
||||
)
|
||||
],
|
||||
},
|
||||
),
|
||||
]
|
@@ -15,7 +15,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import base64
|
||||
import contextlib
|
||||
import os
|
||||
import random
|
||||
import string
|
||||
@@ -1396,49 +1395,3 @@ class ScheduledProductAction(PeriodicTask):
|
||||
# adapted in the case of scheduled product action,
|
||||
# so we skip it and execute directly Model.validate_unique
|
||||
return super(PeriodicTask, self).validate_unique(*args, **kwargs)
|
||||
|
||||
|
||||
class MonthField(models.DateField):
|
||||
description = _("Year + month field (day forced to 1)")
|
||||
default_error_messages = {
|
||||
"invalid": _(
|
||||
"“%(value)s” value has an invalid date format. It must be "
|
||||
"in YYYY-MM format."
|
||||
),
|
||||
"invalid_date": _(
|
||||
"“%(value)s” value has the correct format (YYYY-MM) "
|
||||
"but it is an invalid date."
|
||||
),
|
||||
}
|
||||
|
||||
def to_python(self, value):
|
||||
if isinstance(value, str):
|
||||
with contextlib.suppress(ValueError):
|
||||
# If the string is given as YYYY-mm, try to parse it.
|
||||
# If it fails, it means that the string may be in the form YYYY-mm-dd
|
||||
# or in an invalid format.
|
||||
# Whatever the case, we let Django deal with it
|
||||
# and raise an error if needed
|
||||
value = datetime.strptime(value, "%Y-%m")
|
||||
value = super().to_python(value)
|
||||
if value is None:
|
||||
return None
|
||||
return value.replace(day=1)
|
||||
|
||||
|
||||
class InvoiceCall(models.Model):
|
||||
is_validated = models.BooleanField(verbose_name=_("is validated"), default=False)
|
||||
club = models.ForeignKey(Club, on_delete=models.CASCADE)
|
||||
month = MonthField(verbose_name=_("invoice date"))
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Invoice call")
|
||||
verbose_name_plural = _("Invoice calls")
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
fields=["club", "month"], name="counter_invoicecall_unique_club_month"
|
||||
)
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
return f"invoice call of {self.month} made by {self.club}"
|
||||
|
@@ -4,49 +4,35 @@
|
||||
{% trans %}Invoices call{% endtrans %}
|
||||
{% endblock %}
|
||||
|
||||
{% block notifications %}{# Notifications are moved below #}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h3>{% trans date=start_date|date("F Y") %}Invoices call for {{ date }}{% endtrans %}</h3>
|
||||
<p>{% trans %}Choose another month: {% endtrans %}</p>
|
||||
<form method="get" action="">
|
||||
<label for="id_form_other_month">{% trans %}Choose another month: {% endtrans %}</label>
|
||||
<select name="month" id="id_form_other_month">
|
||||
<select name="month">
|
||||
{% for m in months %}
|
||||
<option value="{{ m|date("Y-m") }}">{{ m|date("Y-m") }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<input type="submit" value="{% trans %}Go{% endtrans %}" />
|
||||
</form>
|
||||
|
||||
<br>
|
||||
<p>{% trans %}CB Payments{% endtrans %} : {{ sum_cb }} €</p>
|
||||
<br>
|
||||
|
||||
{% include "core/base/notifications.jinja" %}
|
||||
|
||||
<form method="post" action="">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
<thead>
|
||||
<table>
|
||||
<thead>
|
||||
<td>{% trans %}Club{% endtrans %}</td>
|
||||
<td>{% trans %}Sum{% endtrans %}</td>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for i in sums %}
|
||||
<tr>
|
||||
<td>{% trans %}Club{% endtrans %}</td>
|
||||
<td>{% trans %}Sum{% endtrans %}</td>
|
||||
<td>{% trans %}Validated{% endtrans %}</td>
|
||||
<td>{{ i['club__name'] }}</td>
|
||||
<td>{{ i['selling_sum'] }} €</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for invoice in invoices %}
|
||||
<tr>
|
||||
<td>{{ invoice.club__name }}</td>
|
||||
<td>{{ "%.2f"|format(invoice.selling_sum) }} €</td>
|
||||
<td>
|
||||
{{ form[invoice.club_id|string] }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="hidden" name="month" value="{{ start_date|date('Y-m') }}">
|
||||
<button type="submit">{% trans %}Save{% endtrans %}</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
|
@@ -1,76 +0,0 @@
|
||||
from datetime import date, datetime
|
||||
|
||||
import pytest
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from django.contrib.auth.models import Permission
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.test import Client
|
||||
from django.urls import reverse
|
||||
from django.utils.timezone import localdate
|
||||
from model_bakery import baker
|
||||
from pytest_django.asserts import assertRedirects
|
||||
|
||||
from club.models import Club
|
||||
from core.models import User
|
||||
from counter.baker_recipes import sale_recipe
|
||||
from counter.forms import InvoiceCallForm
|
||||
from counter.models import Customer, InvoiceCall, Selling
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@pytest.mark.parametrize(
|
||||
"month", [date(2025, 10, 20), "2025-10", datetime(2025, 10, 15, 12, 30)]
|
||||
)
|
||||
def test_invoice_date_with_date(month: date | datetime | str):
|
||||
club = baker.make(Club)
|
||||
invoice = InvoiceCall.objects.create(club=club, month=month)
|
||||
invoice.refresh_from_db()
|
||||
assert not invoice.is_validated
|
||||
assert invoice.month == date(2025, 10, 1)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_invoice_call_invalid_month_string():
|
||||
club = baker.make(Club)
|
||||
|
||||
with pytest.raises(ValidationError):
|
||||
InvoiceCall.objects.create(club=club, month="2025-13")
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@pytest.mark.parametrize("query", [None, {"month": "2025-08"}])
|
||||
def test_invoice_call_view(client: Client, query: dict | None):
|
||||
user = baker.make(
|
||||
User,
|
||||
user_permissions=[
|
||||
*Permission.objects.filter(
|
||||
codename__in=["view_invoicecall", "change_invoicecall"]
|
||||
)
|
||||
],
|
||||
)
|
||||
client.force_login(user)
|
||||
url = reverse("counter:invoices_call", query=query)
|
||||
assert client.get(url).status_code == 200
|
||||
assertRedirects(client.post(url), url)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_invoice_call_form():
|
||||
Selling.objects.all().delete()
|
||||
month = localdate() - relativedelta(months=1)
|
||||
clubs = baker.make(Club, _quantity=2)
|
||||
recipe = sale_recipe.extend(date=month, customer=baker.make(Customer, amount=10000))
|
||||
recipe.make(club=clubs[0], quantity=2, unit_price=200)
|
||||
recipe.make(club=clubs[0], quantity=3, unit_price=5)
|
||||
recipe.make(club=clubs[1], quantity=20, unit_price=10)
|
||||
form = InvoiceCallForm(
|
||||
month=month, data={str(clubs[0].id): True, str(clubs[1].id): False}
|
||||
)
|
||||
assert form.is_valid()
|
||||
form.save()
|
||||
assert InvoiceCall.objects.filter(
|
||||
club=clubs[0], month=month, is_validated=True
|
||||
).exists()
|
||||
assert InvoiceCall.objects.filter(
|
||||
club=clubs[1], month=month, is_validated=False
|
||||
).exists()
|
@@ -12,81 +12,77 @@
|
||||
# OR WITHIN THE LOCAL FILE "LICENSE"
|
||||
#
|
||||
#
|
||||
from datetime import datetime
|
||||
from urllib.parse import urlencode
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import timezone as tz
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from django.contrib.auth.mixins import PermissionRequiredMixin
|
||||
from django.contrib.messages.views import SuccessMessageMixin
|
||||
from django.db.models import F, Sum
|
||||
from django.utils.timezone import localdate, make_aware
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import FormView
|
||||
from django.db.models import F
|
||||
from django.utils import timezone
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from counter.forms import InvoiceCallForm
|
||||
from counter.fields import CurrencyField
|
||||
from counter.models import Refilling, Selling
|
||||
from counter.views.mixins import CounterAdminTabsMixin
|
||||
from counter.views.mixins import CounterAdminMixin, CounterAdminTabsMixin
|
||||
|
||||
|
||||
class InvoiceCallView(
|
||||
CounterAdminTabsMixin, PermissionRequiredMixin, SuccessMessageMixin, FormView
|
||||
):
|
||||
class InvoiceCallView(CounterAdminTabsMixin, CounterAdminMixin, TemplateView):
|
||||
template_name = "counter/invoices_call.jinja"
|
||||
current_tab = "invoices_call"
|
||||
permission_required = ["counter.view_invoicecall", "counter.change_invoicecall"]
|
||||
form_class = InvoiceCallForm
|
||||
success_message = _("Invoice calls status has been updated.")
|
||||
|
||||
def get_month(self):
|
||||
kwargs = self.request.GET or self.request.POST
|
||||
if "month" in kwargs:
|
||||
return make_aware(datetime.strptime(kwargs["month"], "%Y-%m"))
|
||||
return localdate().replace(day=1) - relativedelta(months=1)
|
||||
|
||||
def get_form_kwargs(self):
|
||||
return super().get_form_kwargs() | {"month": self.get_month()}
|
||||
|
||||
def form_valid(self, form):
|
||||
form.save()
|
||||
return super().form_valid(form)
|
||||
|
||||
def get_success_url(self):
|
||||
# redirect to the month from which the request is originated
|
||||
url = self.request.path
|
||||
kwargs = self.request.GET or self.request.POST
|
||||
if "month" in kwargs:
|
||||
query = urlencode({"month": kwargs["month"]})
|
||||
url += f"?{query}"
|
||||
return url
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
"""Add sums to the context."""
|
||||
kwargs = super().get_context_data(**kwargs)
|
||||
kwargs["months"] = Selling.objects.datetimes("date", "month", order="DESC")
|
||||
start_date = self.get_month()
|
||||
end_date = start_date + relativedelta(months=1)
|
||||
|
||||
kwargs["sum_cb"] = Refilling.objects.filter(
|
||||
payment_method="CARD",
|
||||
is_validated=True,
|
||||
date__gte=start_date,
|
||||
date__lte=end_date,
|
||||
).aggregate(res=Sum("amount", default=0))["res"]
|
||||
kwargs["sum_cb"] += (
|
||||
Selling.objects.filter(
|
||||
payment_method="CARD",
|
||||
is_validated=True,
|
||||
date__gte=start_date,
|
||||
date__lte=end_date,
|
||||
if "month" in self.request.GET:
|
||||
start_date = datetime.strptime(self.request.GET["month"], "%Y-%m")
|
||||
else:
|
||||
start_date = datetime(
|
||||
year=timezone.now().year,
|
||||
month=(timezone.now().month + 10) % 12 + 1,
|
||||
day=1,
|
||||
)
|
||||
.annotate(amount=F("unit_price") * F("quantity"))
|
||||
.aggregate(res=Sum("amount", default=0))["res"]
|
||||
start_date = start_date.replace(tzinfo=tz.utc)
|
||||
end_date = (start_date + timedelta(days=32)).replace(
|
||||
day=1, hour=0, minute=0, microsecond=0
|
||||
)
|
||||
from django.db.models import Case, Sum, When
|
||||
|
||||
kwargs["sum_cb"] = sum(
|
||||
[
|
||||
r.amount
|
||||
for r in Refilling.objects.filter(
|
||||
payment_method="CARD",
|
||||
is_validated=True,
|
||||
date__gte=start_date,
|
||||
date__lte=end_date,
|
||||
)
|
||||
]
|
||||
)
|
||||
kwargs["sum_cb"] += sum(
|
||||
[
|
||||
s.quantity * s.unit_price
|
||||
for s in Selling.objects.filter(
|
||||
payment_method="CARD",
|
||||
is_validated=True,
|
||||
date__gte=start_date,
|
||||
date__lte=end_date,
|
||||
)
|
||||
]
|
||||
)
|
||||
kwargs["start_date"] = start_date
|
||||
kwargs["invoices"] = (
|
||||
Selling.objects.filter(date__gte=start_date, date__lt=end_date)
|
||||
.values("club_id", "club__name")
|
||||
.annotate(selling_sum=Sum(F("unit_price") * F("quantity")))
|
||||
kwargs["sums"] = (
|
||||
Selling.objects.values("club__name")
|
||||
.annotate(
|
||||
selling_sum=Sum(
|
||||
Case(
|
||||
When(
|
||||
date__gte=start_date,
|
||||
date__lt=end_date,
|
||||
then=F("unit_price") * F("quantity"),
|
||||
),
|
||||
output_field=CurrencyField(),
|
||||
)
|
||||
)
|
||||
)
|
||||
.exclude(selling_sum=None)
|
||||
.order_by("-selling_sum")
|
||||
)
|
||||
|
@@ -1,5 +1,3 @@
|
||||
{% from 'core/macros.jinja' import update_notifications %}
|
||||
|
||||
<div id=billing-infos-fragment>
|
||||
<div
|
||||
class="collapse"
|
||||
@@ -31,6 +29,7 @@
|
||||
>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
{{ update_notifications(messages) }}
|
||||
{% include "core/base/notifications.jinja" %}
|
||||
</div>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block notifications %}
|
||||
{# Notifications are moved under the billing form #}
|
||||
{# Notifications are moved inside the billing info fragment #}
|
||||
{% endblock %}
|
||||
|
||||
{% block title %}
|
||||
@@ -60,7 +60,6 @@
|
||||
<div @htmx:after-request="fill">
|
||||
{{ billing_infos_form }}
|
||||
</div>
|
||||
{% include "core/base/notifications.jinja" %}
|
||||
<form
|
||||
method="post"
|
||||
action="{{ settings.SITH_EBOUTIC_ET_URL }}"
|
||||
|
@@ -6,7 +6,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-10-17 13:41+0200\n"
|
||||
"POT-Creation-Date: 2025-09-26 17:36+0200\n"
|
||||
"PO-Revision-Date: 2016-07-18\n"
|
||||
"Last-Translator: Maréchal <thomas.girod@utbm.fr\n"
|
||||
"Language-Team: AE info <ae.info@utbm.fr>\n"
|
||||
@@ -556,7 +556,6 @@ msgstr ""
|
||||
#: core/templates/core/user_godfathers_tree.jinja
|
||||
#: core/templates/core/user_preferences.jinja
|
||||
#: counter/templates/counter/cash_register_summary.jinja
|
||||
#: counter/templates/counter/invoices_call.jinja
|
||||
#: counter/templates/counter/product_form.jinja
|
||||
#: forum/templates/forum/reply.jinja
|
||||
#: subscription/templates/subscription/fragments/creation_form.jinja
|
||||
@@ -690,15 +689,15 @@ msgstr "Vente"
|
||||
msgid "Mailing list"
|
||||
msgstr "Listes de diffusion"
|
||||
|
||||
#: club/views.py
|
||||
msgid "You are now a member of this club."
|
||||
msgstr "Vous êtes maintenant membre de ce club."
|
||||
|
||||
#: club/views.py
|
||||
#, python-format
|
||||
msgid "%(user)s has been added to club."
|
||||
msgstr "%(user)s a été ajouté au club."
|
||||
|
||||
#: club/views.py
|
||||
msgid "You are now a member of this club."
|
||||
msgstr "Vous êtes maintenant membre de ce club."
|
||||
|
||||
#: com/forms.py
|
||||
msgid "Format: 16:9 | Resolution: 1920x1080"
|
||||
msgstr "Format : 16:9 | Résolution : 1920x1080"
|
||||
@@ -3315,40 +3314,6 @@ msgstr "Changement des comptoirs"
|
||||
msgid "Product scheduled action"
|
||||
msgstr "Actions sur produit planifiées"
|
||||
|
||||
#: counter/models.py
|
||||
msgid "Product actions must declare a clocked schedule."
|
||||
msgstr "Les actions sur les produits doivent avoir un horaire planifié."
|
||||
|
||||
#: counter/models.py
|
||||
msgid "Year + month field (day forced to 1)"
|
||||
msgstr "Champ Année + mois (jour forcé à 1)"
|
||||
|
||||
#: counter/models.py
|
||||
#, python-format
|
||||
msgid ""
|
||||
"“%(value)s” value has an invalid date format. It must be in YYYY-MM format."
|
||||
msgstr ""
|
||||
"La valeur « %(value)s » a un format de date invalide. Ce doit être au format "
|
||||
"YYYY-MM."
|
||||
|
||||
#: counter/models.py
|
||||
#, python-format
|
||||
msgid ""
|
||||
"“%(value)s” value has the correct format (YYYY-MM) but it is an invalid date."
|
||||
msgstr "La valeur « %(value)s » a le bon format, mais est une date invalide."
|
||||
|
||||
#: counter/models.py
|
||||
msgid "invoice date"
|
||||
msgstr "date de la facture"
|
||||
|
||||
#: counter/models.py
|
||||
msgid "Invoice call"
|
||||
msgstr "Appel à facture"
|
||||
|
||||
#: counter/models.py
|
||||
msgid "Invoice calls"
|
||||
msgstr "Appels à facture"
|
||||
|
||||
#: counter/templates/counter/activity.jinja
|
||||
#, python-format
|
||||
msgid "%(counter_name)s activity"
|
||||
@@ -3579,10 +3544,6 @@ msgstr "Payements en Carte Bancaire"
|
||||
msgid "Sum"
|
||||
msgstr "Somme"
|
||||
|
||||
#: counter/templates/counter/invoices_call.jinja
|
||||
msgid "Validated"
|
||||
msgstr "Validé"
|
||||
|
||||
#: counter/templates/counter/last_ops.jinja
|
||||
#, python-format
|
||||
msgid "%(counter_name)s last operations"
|
||||
@@ -3872,10 +3833,6 @@ msgstr "L'utilisateur n'est pas barman."
|
||||
msgid "Bad location, someone is already logged in somewhere else"
|
||||
msgstr "Mauvais comptoir, quelqu'un est déjà connecté ailleurs"
|
||||
|
||||
#: counter/views/invoice.py
|
||||
msgid "Invoice calls status has been updated."
|
||||
msgstr "Le statut des appels à facture a été mis à jour."
|
||||
|
||||
#: counter/views/mixins.py
|
||||
msgid "Cash summary"
|
||||
msgstr "Relevé de caisse"
|
||||
|
Reference in New Issue
Block a user