mirror of https://gitlab.crans.org/bde/nk20
Remove note activities
This commit is contained in:
parent
12945945bc
commit
dd3b7bd7e5
|
@ -7,7 +7,6 @@ from crispy_forms.layout import Layout
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
|
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from note.models.notes import NoteActivity
|
|
||||||
from note_kfet.inputs import Autocomplete, AmountInput
|
from note_kfet.inputs import Autocomplete, AmountInput
|
||||||
from permission.models import PermissionMask
|
from permission.models import PermissionMask
|
||||||
|
|
||||||
|
@ -59,28 +58,6 @@ class ClubForm(forms.ModelForm):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class NoteActivityForm(forms.ModelForm):
|
|
||||||
class Meta:
|
|
||||||
model = NoteActivity
|
|
||||||
fields = ('note_name', 'club', 'controller', )
|
|
||||||
widgets = {
|
|
||||||
"club": Autocomplete(
|
|
||||||
Club,
|
|
||||||
attrs={
|
|
||||||
'api_url': '/api/members/club/',
|
|
||||||
}
|
|
||||||
),
|
|
||||||
"controller": Autocomplete(
|
|
||||||
User,
|
|
||||||
attrs={
|
|
||||||
'api_url': '/api/user/',
|
|
||||||
'name_field': 'username',
|
|
||||||
'placeholder': 'Nom ...',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class AddMembersForm(forms.Form):
|
class AddMembersForm(forms.Form):
|
||||||
class Meta:
|
class Meta:
|
||||||
fields = ('',)
|
fields = ('',)
|
||||||
|
|
|
@ -16,14 +16,6 @@ urlpatterns = [
|
||||||
path('club/<int:pk>/update/', views.ClubUpdateView.as_view(), name="club_update"),
|
path('club/<int:pk>/update/', views.ClubUpdateView.as_view(), name="club_update"),
|
||||||
path('club/<int:pk>/update_pic/', views.ClubPictureUpdateView.as_view(), name="club_update_pic"),
|
path('club/<int:pk>/update_pic/', views.ClubPictureUpdateView.as_view(), name="club_update_pic"),
|
||||||
path('club/<int:pk>/aliases/', views.ClubAliasView.as_view(), name="club_alias"),
|
path('club/<int:pk>/aliases/', views.ClubAliasView.as_view(), name="club_alias"),
|
||||||
path('club/<int:pk>/linked_notes/', views.ClubLinkedNotesView.as_view(),
|
|
||||||
name="club_linked_note_list"),
|
|
||||||
path('club/<int:club_pk>/linked_notes/create/', views.ClubLinkedNoteCreateView.as_view(),
|
|
||||||
name="club_linked_note_create"),
|
|
||||||
path('club/<int:club_pk>/linked_notes/<int:pk>/', views.ClubLinkedNoteDetailView.as_view(),
|
|
||||||
name="club_linked_note_detail"),
|
|
||||||
path('club/<int:club_pk>/linked_notes/<int:pk>/update/', views.ClubLinkedNoteUpdateView.as_view(),
|
|
||||||
name="club_linked_note_update"),
|
|
||||||
|
|
||||||
path('user/', views.UserListView.as_view(), name="user_list"),
|
path('user/', views.UserListView.as_view(), name="user_list"),
|
||||||
path('user/<int:pk>', views.UserDetailView.as_view(), name="user_detail"),
|
path('user/<int:pk>', views.UserDetailView.as_view(), name="user_detail"),
|
||||||
|
|
|
@ -18,15 +18,14 @@ from django_tables2.views import SingleTableView
|
||||||
from rest_framework.authtoken.models import Token
|
from rest_framework.authtoken.models import Token
|
||||||
from note.forms import ImageForm
|
from note.forms import ImageForm
|
||||||
from note.models import Alias, NoteUser
|
from note.models import Alias, NoteUser
|
||||||
from note.models.notes import NoteActivity
|
|
||||||
from note.models.transactions import Transaction
|
from note.models.transactions import Transaction
|
||||||
from note.tables import HistoryTable, AliasTable, NoteActivityTable
|
from note.tables import HistoryTable, AliasTable
|
||||||
from permission.backends import PermissionBackend
|
from permission.backends import PermissionBackend
|
||||||
from permission.views import ProtectQuerysetMixin
|
from permission.views import ProtectQuerysetMixin
|
||||||
|
|
||||||
from .filters import UserFilter, UserFilterFormHelper
|
from .filters import UserFilter, UserFilterFormHelper
|
||||||
from .forms import SignUpForm, ProfileForm, ClubForm, MembershipForm, MemberFormSet, FormSetHelper, \
|
from .forms import SignUpForm, ProfileForm, ClubForm, MembershipForm, MemberFormSet, FormSetHelper, \
|
||||||
CustomAuthenticationForm, NoteActivityForm
|
CustomAuthenticationForm
|
||||||
from .models import Club, Membership
|
from .models import Club, Membership
|
||||||
from .tables import ClubTable, UserTable
|
from .tables import ClubTable, UserTable
|
||||||
|
|
||||||
|
@ -357,82 +356,3 @@ class ClubAddMemberView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
|
||||||
def form_valid(self, formset):
|
def form_valid(self, formset):
|
||||||
formset.save()
|
formset.save()
|
||||||
return super().form_valid(formset)
|
return super().form_valid(formset)
|
||||||
|
|
||||||
|
|
||||||
class ClubLinkedNotesView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
|
|
||||||
model = NoteActivity
|
|
||||||
table_class = NoteActivityTable
|
|
||||||
|
|
||||||
def get_queryset(self):
|
|
||||||
return super().get_queryset().filter(club=self.get_object())
|
|
||||||
|
|
||||||
def get_object(self):
|
|
||||||
if hasattr(self, 'object'):
|
|
||||||
return self.object
|
|
||||||
self.object = Club.objects.filter(PermissionBackend.filter_queryset(self.request.user, Club, "view"))\
|
|
||||||
.get(pk=int(self.kwargs["pk"]))
|
|
||||||
return self.object
|
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
|
||||||
ctx = super().get_context_data(**kwargs)
|
|
||||||
|
|
||||||
club = ctx["object"] = ctx["club"] = self.get_object()
|
|
||||||
|
|
||||||
empty_note = NoteActivity(note_name="", club=club, controller=self.request.user)
|
|
||||||
ctx["can_create"] = PermissionBackend().has_perm(self.request.user, "note.add_noteactivity", empty_note)
|
|
||||||
|
|
||||||
return ctx
|
|
||||||
|
|
||||||
|
|
||||||
class ClubLinkedNoteCreateView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
|
|
||||||
model = NoteActivity
|
|
||||||
form_class = NoteActivityForm
|
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
|
||||||
ctx = super().get_context_data(**kwargs)
|
|
||||||
|
|
||||||
club = Club.objects.filter(PermissionBackend.filter_queryset(self.request.user, Club, "view"))\
|
|
||||||
.get(pk=self.kwargs["club_pk"])
|
|
||||||
ctx["object"] = ctx["club"] = club
|
|
||||||
ctx["form"].fields["club"].initial = club
|
|
||||||
|
|
||||||
return ctx
|
|
||||||
|
|
||||||
def get_success_url(self):
|
|
||||||
self.object.refresh_from_db()
|
|
||||||
return reverse_lazy('member:club_linked_note_detail',
|
|
||||||
kwargs={"club_pk": self.object.club.pk, "pk": self.object.pk})
|
|
||||||
|
|
||||||
|
|
||||||
class ClubLinkedNoteUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
|
|
||||||
model = NoteActivity
|
|
||||||
form_class = NoteActivityForm
|
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
|
||||||
ctx = super().get_context_data(**kwargs)
|
|
||||||
|
|
||||||
ctx["club"] = Club.objects.filter(PermissionBackend.filter_queryset(self.request.user, Club, "view"))\
|
|
||||||
.get(pk=self.kwargs["club_pk"])
|
|
||||||
|
|
||||||
return ctx
|
|
||||||
|
|
||||||
def get_success_url(self):
|
|
||||||
return reverse_lazy('member:club_linked_note_detail',
|
|
||||||
kwargs={"club_pk": self.object.club.pk, "pk": self.object.pk})
|
|
||||||
|
|
||||||
|
|
||||||
class ClubLinkedNoteDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
|
|
||||||
model = NoteActivity
|
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
|
||||||
ctx = super().get_context_data(**kwargs)
|
|
||||||
|
|
||||||
note = self.get_queryset().filter(pk=self.kwargs["pk"]).get()
|
|
||||||
|
|
||||||
transactions = Transaction.objects.filter(Q(source=note) | Q(destination=note))\
|
|
||||||
.filter(PermissionBackend.filter_queryset(self.request.user, Transaction, "view")).order_by("-id")
|
|
||||||
ctx['history_list'] = HistoryTable(transactions)
|
|
||||||
ctx["note"] = note
|
|
||||||
ctx["club"] = note.club
|
|
||||||
|
|
||||||
return ctx
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ from django.utils.translation import gettext_lazy as _
|
||||||
from polymorphic.admin import PolymorphicChildModelAdmin, \
|
from polymorphic.admin import PolymorphicChildModelAdmin, \
|
||||||
PolymorphicChildModelFilter, PolymorphicParentModelAdmin
|
PolymorphicChildModelFilter, PolymorphicParentModelAdmin
|
||||||
|
|
||||||
from .models.notes import Alias, Note, NoteClub, NoteSpecial, NoteUser, NoteActivity
|
from .models.notes import Alias, Note, NoteClub, NoteSpecial, NoteUser
|
||||||
from .models.transactions import Transaction, TemplateCategory, TransactionTemplate, \
|
from .models.transactions import Transaction, TemplateCategory, TransactionTemplate, \
|
||||||
RecurrentTransaction, MembershipTransaction
|
RecurrentTransaction, MembershipTransaction
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class NoteAdmin(PolymorphicParentModelAdmin):
|
||||||
"""
|
"""
|
||||||
Parent regrouping all note types as children
|
Parent regrouping all note types as children
|
||||||
"""
|
"""
|
||||||
child_models = (NoteClub, NoteSpecial, NoteUser, NoteActivity)
|
child_models = (NoteClub, NoteSpecial, NoteUser)
|
||||||
list_filter = (
|
list_filter = (
|
||||||
PolymorphicChildModelFilter,
|
PolymorphicChildModelFilter,
|
||||||
'is_active',
|
'is_active',
|
||||||
|
@ -74,14 +74,6 @@ class NoteSpecialAdmin(PolymorphicChildModelAdmin):
|
||||||
readonly_fields = ('balance',)
|
readonly_fields = ('balance',)
|
||||||
|
|
||||||
|
|
||||||
@admin.register(NoteActivity)
|
|
||||||
class NoteActivityAdmin(PolymorphicChildModelAdmin):
|
|
||||||
"""
|
|
||||||
Child for a special note, see NoteAdmin
|
|
||||||
"""
|
|
||||||
readonly_fields = ('balance',)
|
|
||||||
|
|
||||||
|
|
||||||
@admin.register(NoteUser)
|
@admin.register(NoteUser)
|
||||||
class NoteUserAdmin(PolymorphicChildModelAdmin):
|
class NoteUserAdmin(PolymorphicChildModelAdmin):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from rest_polymorphic.serializers import PolymorphicSerializer
|
from rest_polymorphic.serializers import PolymorphicSerializer
|
||||||
|
|
||||||
from ..models.notes import Note, NoteClub, NoteSpecial, NoteUser, Alias, NoteActivity
|
from ..models.notes import Note, NoteClub, NoteSpecial, NoteUser, Alias
|
||||||
from ..models.transactions import TransactionTemplate, Transaction, MembershipTransaction, TemplateCategory, \
|
from ..models.transactions import TransactionTemplate, Transaction, MembershipTransaction, TemplateCategory, \
|
||||||
RecurrentTransaction, SpecialTransaction
|
RecurrentTransaction, SpecialTransaction
|
||||||
|
|
||||||
|
@ -69,22 +69,6 @@ class NoteUserSerializer(serializers.ModelSerializer):
|
||||||
return str(obj)
|
return str(obj)
|
||||||
|
|
||||||
|
|
||||||
class NoteActivitySerializer(serializers.ModelSerializer):
|
|
||||||
"""
|
|
||||||
REST API Serializer for User's notes.
|
|
||||||
The djangorestframework plugin will analyse the model `NoteActivity` and parse all fields in the API.
|
|
||||||
"""
|
|
||||||
name = serializers.SerializerMethodField()
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
model = NoteActivity
|
|
||||||
fields = '__all__'
|
|
||||||
read_only_fields = ('note', 'user', )
|
|
||||||
|
|
||||||
def get_name(self, obj):
|
|
||||||
return str(obj)
|
|
||||||
|
|
||||||
|
|
||||||
class AliasSerializer(serializers.ModelSerializer):
|
class AliasSerializer(serializers.ModelSerializer):
|
||||||
"""
|
"""
|
||||||
REST API Serializer for Aliases.
|
REST API Serializer for Aliases.
|
||||||
|
@ -107,7 +91,6 @@ class NotePolymorphicSerializer(PolymorphicSerializer):
|
||||||
NoteUser: NoteUserSerializer,
|
NoteUser: NoteUserSerializer,
|
||||||
NoteClub: NoteClubSerializer,
|
NoteClub: NoteClubSerializer,
|
||||||
NoteSpecial: NoteSpecialSerializer,
|
NoteSpecial: NoteSpecialSerializer,
|
||||||
NoteActivity: NoteActivitySerializer,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
from .notes import Alias, Note, NoteClub, NoteSpecial, NoteUser, NoteActivity
|
from .notes import Alias, Note, NoteClub, NoteSpecial, NoteUser
|
||||||
from .transactions import MembershipTransaction, Transaction, \
|
from .transactions import MembershipTransaction, Transaction, \
|
||||||
TemplateCategory, TransactionTemplate, RecurrentTransaction, SpecialTransaction
|
TemplateCategory, TransactionTemplate, RecurrentTransaction, SpecialTransaction
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
# Notes
|
# Notes
|
||||||
'Alias', 'Note', 'NoteClub', 'NoteSpecial', 'NoteUser', 'NoteActivity',
|
'Alias', 'Note', 'NoteClub', 'NoteSpecial', 'NoteUser',
|
||||||
# Transactions
|
# Transactions
|
||||||
'MembershipTransaction', 'Transaction', 'TemplateCategory', 'TransactionTemplate',
|
'MembershipTransaction', 'Transaction', 'TemplateCategory', 'TransactionTemplate',
|
||||||
'RecurrentTransaction', 'SpecialTransaction',
|
'RecurrentTransaction', 'SpecialTransaction',
|
||||||
|
|
|
@ -4,13 +4,11 @@
|
||||||
import unicodedata
|
import unicodedata
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import User
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.core.validators import RegexValidator
|
from django.core.validators import RegexValidator
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from polymorphic.models import PolymorphicModel
|
from polymorphic.models import PolymorphicModel
|
||||||
from member.models import Club
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Defines each note types
|
Defines each note types
|
||||||
|
@ -176,40 +174,6 @@ class NoteSpecial(Note):
|
||||||
return self.special_type
|
return self.special_type
|
||||||
|
|
||||||
|
|
||||||
class NoteActivity(Note):
|
|
||||||
"""
|
|
||||||
A :model:`note.Note` for accounts that are not attached to a user neither to a club,
|
|
||||||
that only need to store and transfer money (notes for activities, departments, ...)
|
|
||||||
"""
|
|
||||||
|
|
||||||
note_name = models.CharField(
|
|
||||||
verbose_name=_('name'),
|
|
||||||
max_length=255,
|
|
||||||
unique=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
club = models.ForeignKey(
|
|
||||||
Club,
|
|
||||||
on_delete=models.PROTECT,
|
|
||||||
related_name="linked_notes",
|
|
||||||
verbose_name=_("club"),
|
|
||||||
)
|
|
||||||
|
|
||||||
controller = models.ForeignKey(
|
|
||||||
User,
|
|
||||||
on_delete=models.PROTECT,
|
|
||||||
related_name="+",
|
|
||||||
verbose_name=_("controller"),
|
|
||||||
)
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
verbose_name = _("activity note")
|
|
||||||
verbose_name_plural = _("activity notes")
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return self.note_name
|
|
||||||
|
|
||||||
|
|
||||||
class Alias(models.Model):
|
class Alias(models.Model):
|
||||||
"""
|
"""
|
||||||
points toward a :model:`note.NoteUser` or :model;`note.NoteClub` instance.
|
points toward a :model:`note.NoteUser` or :model;`note.NoteClub` instance.
|
||||||
|
|
|
@ -9,7 +9,7 @@ from django.utils.html import format_html
|
||||||
from django_tables2.utils import A
|
from django_tables2.utils import A
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from .models.notes import Alias, NoteActivity
|
from .models.notes import Alias
|
||||||
from .models.transactions import Transaction, TransactionTemplate
|
from .models.transactions import Transaction, TransactionTemplate
|
||||||
from .templatetags.pretty_money import pretty_money
|
from .templatetags.pretty_money import pretty_money
|
||||||
|
|
||||||
|
@ -121,24 +121,6 @@ class AliasTable(tables.Table):
|
||||||
attrs={'td': {'class': 'col-sm-1'}})
|
attrs={'td': {'class': 'col-sm-1'}})
|
||||||
|
|
||||||
|
|
||||||
class NoteActivityTable(tables.Table):
|
|
||||||
note_name = tables.LinkColumn(
|
|
||||||
"member:club_linked_note_detail",
|
|
||||||
args=[A("club.pk"), A("pk")],
|
|
||||||
)
|
|
||||||
|
|
||||||
def render_balance(self, value):
|
|
||||||
return pretty_money(value)
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
attrs = {
|
|
||||||
'class': 'table table-condensed table-striped table-hover'
|
|
||||||
}
|
|
||||||
model = NoteActivity
|
|
||||||
fields = ('note_name', 'balance',)
|
|
||||||
template_name = 'django_tables2/bootstrap4.html'
|
|
||||||
|
|
||||||
|
|
||||||
class ButtonTable(tables.Table):
|
class ButtonTable(tables.Table):
|
||||||
class Meta:
|
class Meta:
|
||||||
attrs = {
|
attrs = {
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.contrib.auth.backends import ModelBackend
|
||||||
from django.contrib.auth.models import User, AnonymousUser
|
from django.contrib.auth.models import User, AnonymousUser
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.db.models import Q, F
|
from django.db.models import Q, F
|
||||||
from note.models import Note, NoteUser, NoteClub, NoteSpecial, NoteActivity
|
from note.models import Note, NoteUser, NoteClub, NoteSpecial
|
||||||
from note_kfet.middlewares import get_current_session
|
from note_kfet.middlewares import get_current_session
|
||||||
from member.models import Membership, Club
|
from member.models import Membership, Club
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@ class PermissionBackend(ModelBackend):
|
||||||
NoteUser=NoteUser,
|
NoteUser=NoteUser,
|
||||||
NoteClub=NoteClub,
|
NoteClub=NoteClub,
|
||||||
NoteSpecial=NoteSpecial,
|
NoteSpecial=NoteSpecial,
|
||||||
NoteActivity=NoteActivity,
|
|
||||||
F=F,
|
F=F,
|
||||||
Q=Q
|
Q=Q
|
||||||
)
|
)
|
||||||
|
|
|
@ -176,7 +176,7 @@
|
||||||
"note",
|
"note",
|
||||||
"alias"
|
"alias"
|
||||||
],
|
],
|
||||||
"query": "[\"OR\", {\"note__in\": [\"NoteUser\", \"objects\", [\"filter\", {\"user__membership__club__name\": \"Kfet\"}], [\"all\"]]}, {\"note__in\": [\"NoteClub\", \"objects\", [\"all\"]]}, {\"note__in\": [\"NoteActivity\", \"objects\", [\"all\"]]}]",
|
"query": "[\"OR\", {\"note__in\": [\"NoteUser\", \"objects\", [\"filter\", {\"user__membership__club__name\": \"Kfet\"}], [\"all\"]]}, {\"note__in\": [\"NoteClub\", \"objects\", [\"all\"]]}]",
|
||||||
"type": "view",
|
"type": "view",
|
||||||
"mask": 1,
|
"mask": 1,
|
||||||
"field": "",
|
"field": "",
|
||||||
|
@ -798,96 +798,6 @@
|
||||||
"description": "Update club"
|
"description": "Update club"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"model": "permission.permission",
|
|
||||||
"pk": 48,
|
|
||||||
"fields": {
|
|
||||||
"model": [
|
|
||||||
"note",
|
|
||||||
"noteactivity"
|
|
||||||
],
|
|
||||||
"query": "{\"club\": [\"club\"]}",
|
|
||||||
"type": "change",
|
|
||||||
"mask": 1,
|
|
||||||
"field": "",
|
|
||||||
"description": "Manage notes that are linked to a club"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"model": "permission.permission",
|
|
||||||
"pk": 49,
|
|
||||||
"fields": {
|
|
||||||
"model": [
|
|
||||||
"note",
|
|
||||||
"noteactivity"
|
|
||||||
],
|
|
||||||
"query": "{\"club\": [\"club\"]}",
|
|
||||||
"type": "view",
|
|
||||||
"mask": 1,
|
|
||||||
"field": "",
|
|
||||||
"description": "View notes that are linked to a club"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"model": "permission.permission",
|
|
||||||
"pk": 50,
|
|
||||||
"fields": {
|
|
||||||
"model": [
|
|
||||||
"note",
|
|
||||||
"transaction"
|
|
||||||
],
|
|
||||||
"query": "[\"AND\", [\"OR\", {\"source__noteactivity__controller\": [\"user\"]}, {\"destination__noteactivity__controller\": [\"user\"]}], [\"OR\", {\"amount__lte\": {\"F\": [\"ADD\", [\"F\", \"source__balance\"], 5000]}}, {\"valid\": false}]]",
|
|
||||||
"type": "add",
|
|
||||||
"mask": 2,
|
|
||||||
"field": "",
|
|
||||||
"description": "Add transactions linked to a noteactivity"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"model": "permission.permission",
|
|
||||||
"pk": 51,
|
|
||||||
"fields": {
|
|
||||||
"model": [
|
|
||||||
"note",
|
|
||||||
"transaction"
|
|
||||||
],
|
|
||||||
"query": "[\"AND\", [\"OR\", {\"source__noteactivity__controller\": [\"user\"]}, {\"destination__noteactivity__controller\": [\"user\"]}]]",
|
|
||||||
"type": "view",
|
|
||||||
"mask": 1,
|
|
||||||
"field": "",
|
|
||||||
"description": "View transactions linked to a noteactivity"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"model": "permission.permission",
|
|
||||||
"pk": 52,
|
|
||||||
"fields": {
|
|
||||||
"model": [
|
|
||||||
"note",
|
|
||||||
"note"
|
|
||||||
],
|
|
||||||
"query": "{\"noteactivity__controller\": [\"user\"]}",
|
|
||||||
"type": "view",
|
|
||||||
"mask": 1,
|
|
||||||
"field": "",
|
|
||||||
"description": "View note activity"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"model": "permission.permission",
|
|
||||||
"pk": 53,
|
|
||||||
"fields": {
|
|
||||||
"model": [
|
|
||||||
"note",
|
|
||||||
"noteactivity"
|
|
||||||
],
|
|
||||||
"query": "{\"controller\": [\"user\"]}",
|
|
||||||
"type": "view",
|
|
||||||
"mask": 1,
|
|
||||||
"field": "",
|
|
||||||
"description": "View note activity"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"model": "permission.rolepermissions",
|
"model": "permission.rolepermissions",
|
||||||
"pk": 1,
|
"pk": 1,
|
||||||
|
@ -915,6 +825,7 @@
|
||||||
3,
|
3,
|
||||||
4,
|
4,
|
||||||
5,
|
5,
|
||||||
|
6,
|
||||||
7,
|
7,
|
||||||
8,
|
8,
|
||||||
9,
|
9,
|
||||||
|
@ -932,11 +843,6 @@
|
||||||
36,
|
36,
|
||||||
39,
|
39,
|
||||||
40,
|
40,
|
||||||
6,
|
|
||||||
52,
|
|
||||||
53,
|
|
||||||
51,
|
|
||||||
50
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -947,9 +853,9 @@
|
||||||
"role": 8,
|
"role": 8,
|
||||||
"permissions": [
|
"permissions": [
|
||||||
19,
|
19,
|
||||||
|
20,
|
||||||
21,
|
21,
|
||||||
22,
|
22
|
||||||
20
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -997,9 +903,7 @@
|
||||||
"role": 7,
|
"role": 7,
|
||||||
"permissions": [
|
"permissions": [
|
||||||
22,
|
22,
|
||||||
47,
|
47
|
||||||
48,
|
|
||||||
49
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -456,18 +456,6 @@ msgstr ""
|
||||||
msgid "special notes"
|
msgid "special notes"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: apps/note/models/notes.py:202 templates/note/noteactivity_detail.html:22
|
|
||||||
msgid "controller"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: apps/note/models/notes.py:206
|
|
||||||
msgid "activity note"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: apps/note/models/notes.py:207
|
|
||||||
msgid "activity notes"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: apps/note/models/notes.py:230
|
#: apps/note/models/notes.py:230
|
||||||
msgid "Invalid alias"
|
msgid "Invalid alias"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -626,7 +614,7 @@ msgstr ""
|
||||||
#: templates/activity/activity_form.html:9
|
#: templates/activity/activity_form.html:9
|
||||||
#: templates/activity/activity_invite.html:8
|
#: templates/activity/activity_invite.html:8
|
||||||
#: templates/django_filters/rest_framework/form.html:5
|
#: templates/django_filters/rest_framework/form.html:5
|
||||||
#: templates/member/club_form.html:9 templates/note/noteactivity_form.html:14
|
#: templates/member/club_form.html:9
|
||||||
#: templates/treasury/invoice_form.html:46
|
#: templates/treasury/invoice_form.html:46
|
||||||
msgid "Submit"
|
msgid "Submit"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -903,7 +891,6 @@ msgid "Add member"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: templates/member/club_info.html:45 templates/note/conso_form.html:121
|
#: templates/member/club_info.html:45 templates/note/conso_form.html:121
|
||||||
#: templates/note/noteactivity_detail.html:31
|
|
||||||
msgid "Edit"
|
msgid "Edit"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -932,7 +919,6 @@ msgid "Member of the Club"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: templates/member/club_tables.html:22 templates/member/profile_tables.html:22
|
#: templates/member/club_tables.html:22 templates/member/profile_tables.html:22
|
||||||
#: templates/note/noteactivity_detail.html:42
|
|
||||||
msgid "Transaction history"
|
msgid "Transaction history"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -965,7 +951,6 @@ msgid "Change password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: templates/member/profile_info.html:33
|
#: templates/member/profile_info.html:33
|
||||||
#: templates/note/noteactivity_detail.html:25
|
|
||||||
msgid "balance"
|
msgid "balance"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -1014,22 +999,6 @@ msgstr ""
|
||||||
msgid "Recent transactions history"
|
msgid "Recent transactions history"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: templates/note/noteactivity_detail.html:15
|
|
||||||
msgid "Linked note:"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: templates/note/noteactivity_detail.html:19
|
|
||||||
msgid "attached club"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: templates/note/noteactivity_list.html:15
|
|
||||||
msgid "linked notes of club"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: templates/note/noteactivity_list.html:24
|
|
||||||
msgid "Add new note"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: templates/note/transaction_form.html:15
|
#: templates/note/transaction_form.html:15
|
||||||
msgid "Gift"
|
msgid "Gift"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
|
@ -457,18 +457,6 @@ msgstr "note spéciale"
|
||||||
msgid "special notes"
|
msgid "special notes"
|
||||||
msgstr "notes spéciales"
|
msgstr "notes spéciales"
|
||||||
|
|
||||||
#: apps/note/models/notes.py:202 templates/note/noteactivity_detail.html:22
|
|
||||||
msgid "controller"
|
|
||||||
msgstr "contrôleur"
|
|
||||||
|
|
||||||
#: apps/note/models/notes.py:206
|
|
||||||
msgid "activity note"
|
|
||||||
msgstr "note d'activité"
|
|
||||||
|
|
||||||
#: apps/note/models/notes.py:207
|
|
||||||
msgid "activity notes"
|
|
||||||
msgstr "notes d'activité"
|
|
||||||
|
|
||||||
#: apps/note/models/notes.py:230
|
#: apps/note/models/notes.py:230
|
||||||
msgid "Invalid alias"
|
msgid "Invalid alias"
|
||||||
msgstr "Alias invalide"
|
msgstr "Alias invalide"
|
||||||
|
@ -627,7 +615,7 @@ msgstr "Trésorerie"
|
||||||
#: templates/activity/activity_form.html:9
|
#: templates/activity/activity_form.html:9
|
||||||
#: templates/activity/activity_invite.html:8
|
#: templates/activity/activity_invite.html:8
|
||||||
#: templates/django_filters/rest_framework/form.html:5
|
#: templates/django_filters/rest_framework/form.html:5
|
||||||
#: templates/member/club_form.html:9 templates/note/noteactivity_form.html:14
|
#: templates/member/club_form.html:9
|
||||||
#: templates/treasury/invoice_form.html:46
|
#: templates/treasury/invoice_form.html:46
|
||||||
msgid "Submit"
|
msgid "Submit"
|
||||||
msgstr "Envoyer"
|
msgstr "Envoyer"
|
||||||
|
@ -906,7 +894,6 @@ msgid "Add member"
|
||||||
msgstr "Ajouter un membre"
|
msgstr "Ajouter un membre"
|
||||||
|
|
||||||
#: templates/member/club_info.html:45 templates/note/conso_form.html:121
|
#: templates/member/club_info.html:45 templates/note/conso_form.html:121
|
||||||
#: templates/note/noteactivity_detail.html:31
|
|
||||||
msgid "Edit"
|
msgid "Edit"
|
||||||
msgstr "Éditer"
|
msgstr "Éditer"
|
||||||
|
|
||||||
|
@ -935,7 +922,6 @@ msgid "Member of the Club"
|
||||||
msgstr "Membre du club"
|
msgstr "Membre du club"
|
||||||
|
|
||||||
#: templates/member/club_tables.html:22 templates/member/profile_tables.html:22
|
#: templates/member/club_tables.html:22 templates/member/profile_tables.html:22
|
||||||
#: templates/note/noteactivity_detail.html:42
|
|
||||||
msgid "Transaction history"
|
msgid "Transaction history"
|
||||||
msgstr "Historique des transactions"
|
msgstr "Historique des transactions"
|
||||||
|
|
||||||
|
@ -968,7 +954,6 @@ msgid "Change password"
|
||||||
msgstr "Changer le mot de passe"
|
msgstr "Changer le mot de passe"
|
||||||
|
|
||||||
#: templates/member/profile_info.html:33
|
#: templates/member/profile_info.html:33
|
||||||
#: templates/note/noteactivity_detail.html:25
|
|
||||||
msgid "balance"
|
msgid "balance"
|
||||||
msgstr "solde du compte"
|
msgstr "solde du compte"
|
||||||
|
|
||||||
|
@ -1017,22 +1002,6 @@ msgstr "Consommations doubles"
|
||||||
msgid "Recent transactions history"
|
msgid "Recent transactions history"
|
||||||
msgstr "Historique des transactions récentes"
|
msgstr "Historique des transactions récentes"
|
||||||
|
|
||||||
#: templates/note/noteactivity_detail.html:15
|
|
||||||
msgid "Linked note:"
|
|
||||||
msgstr "note attachée :"
|
|
||||||
|
|
||||||
#: templates/note/noteactivity_detail.html:19
|
|
||||||
msgid "attached club"
|
|
||||||
msgstr "club lié"
|
|
||||||
|
|
||||||
#: templates/note/noteactivity_list.html:15
|
|
||||||
msgid "linked notes of club"
|
|
||||||
msgstr "Notes liées au club"
|
|
||||||
|
|
||||||
#: templates/note/noteactivity_list.html:24
|
|
||||||
msgid "Add new note"
|
|
||||||
msgstr "Ajouter une note"
|
|
||||||
|
|
||||||
#: templates/note/transaction_form.html:15
|
#: templates/note/transaction_form.html:15
|
||||||
msgid "Gift"
|
msgid "Gift"
|
||||||
msgstr "Don"
|
msgstr "Don"
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
{% extends "member/noteowner_detail.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
{% load render_table from django_tables2 %}
|
|
||||||
{% load pretty_money %}
|
|
||||||
{% load perms %}
|
|
||||||
|
|
||||||
{% block profile_info %}
|
|
||||||
{% include "member/club_info.html" %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block profile_content %}
|
|
||||||
<div id="activity_info" class="card bg-light shadow">
|
|
||||||
<div class="card-header text-center">
|
|
||||||
<h4>{% trans "Linked note:" %} {{ note.note_name }}</h4>
|
|
||||||
</div>
|
|
||||||
<div class="card-body" id="profile_infos">
|
|
||||||
<dl class="row">
|
|
||||||
<dt class="col-xl-6">{% trans 'attached club'|capfirst %}</dt>
|
|
||||||
<dd class="col-xl-6"><a href="{% url 'member:club_detail' pk=club.pk %}">{{ club }}</a></dd>
|
|
||||||
|
|
||||||
<dt class="col-xl-6">{% trans 'controller'|capfirst %}</dt>
|
|
||||||
<dd class="col-xl-6"><a href="{% url 'member:user_detail' pk=note.controller.pk %}">{{ note.controller }}</a></dd>
|
|
||||||
|
|
||||||
<dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt>
|
|
||||||
<dd class="col-xl-6">{{ note.balance|pretty_money }}</dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
{% if "change_"|has_perm:note %}
|
|
||||||
<div class="card-footer text-center">
|
|
||||||
<a class="btn btn-primary btn-sm my-1" href="{% url 'member:club_linked_note_update' club_pk=club.pk pk=note.pk %}"> {% trans "Edit" %}</a>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header position-relative" id="historyListHeading">
|
|
||||||
<a class="btn btn-link stretched-link collapsed font-weight-bold"
|
|
||||||
data-toggle="collapse" data-target="#historyListCollapse"
|
|
||||||
aria-expanded="false" aria-controls="historyListCollapse">
|
|
||||||
<i class="fa fa-euro"></i> {% trans "Transaction history" %}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div id="historyListCollapse" aria-labelledby="historyListHeading" data-parent="#accordionProfile">
|
|
||||||
<div id="history_list">
|
|
||||||
{% render_table history_list %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block extrajavascript %}
|
|
||||||
<script>
|
|
||||||
function refreshHistory() {
|
|
||||||
$("#history_list").load("{% url 'member:club_linked_note_detail' club_pk=club.pk pk=note.pk %} #history_list");
|
|
||||||
$("#profile_infos").load("{% url 'member:club_detail' pk=club.pk%} #profile_infos");
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
|
@ -1,16 +0,0 @@
|
||||||
{% extends "member/noteowner_detail.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
{% load crispy_forms_tags %}
|
|
||||||
|
|
||||||
{% block profile_info %}
|
|
||||||
{% include "member/club_info.html" %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block profile_content %}
|
|
||||||
<form method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
{{ form|crispy }}
|
|
||||||
<button class="btn btn-primary" type="submit">{% trans "Submit" %}</button>
|
|
||||||
</form>
|
|
||||||
{% endblock %}
|
|
|
@ -1,29 +0,0 @@
|
||||||
{% extends "member/noteowner_detail.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
{% load render_table from django_tables2 %}
|
|
||||||
|
|
||||||
{% block profile_info %}
|
|
||||||
{% include "member/club_info.html" %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block profile_content %}
|
|
||||||
<div class="row justify-content-center">
|
|
||||||
<div class="col-md-10">
|
|
||||||
<div class="card card-border shadow">
|
|
||||||
<div class="card-header text-center">
|
|
||||||
<h5> {% trans "linked notes of club"|capfirst %} {{ club.name }}</h5>
|
|
||||||
</div>
|
|
||||||
<div class="card-body px-0 py-0" id="club_table">
|
|
||||||
{% render_table table %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if can_create %}
|
|
||||||
<a href="{% url 'member:club_linked_note_create' club_pk=club.pk %}">
|
|
||||||
<button class="btn btn-primary btn-block">{% trans "Add new note" %}</button>
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
Loading…
Reference in New Issue