mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-27 02:43:01 +00:00
42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
|
# SPDX-License-Identifier: GPL-3.0-or-lateré
|
|
|
|
from django.contrib import admin
|
|
from note_kfet.admin import admin_site
|
|
|
|
from .models import RemittanceType, Remittance, SogeCredit
|
|
|
|
|
|
@admin.register(RemittanceType, site=admin_site)
|
|
class RemittanceTypeAdmin(admin.ModelAdmin):
|
|
"""
|
|
Admin customisation for RemiitanceType
|
|
"""
|
|
list_display = ('note', )
|
|
|
|
|
|
@admin.register(Remittance, site=admin_site)
|
|
class RemittanceAdmin(admin.ModelAdmin):
|
|
"""
|
|
Admin customisation for Remittance
|
|
"""
|
|
list_display = ('remittance_type', 'date', 'comment', 'count', 'amount', 'closed', )
|
|
|
|
def has_change_permission(self, request, obj=None):
|
|
if not obj:
|
|
return True
|
|
return not obj.closed and super().has_change_permission(request, obj)
|
|
|
|
|
|
@admin.register(SogeCredit, site=admin_site)
|
|
class SogeCreditAdmin(admin.ModelAdmin):
|
|
"""
|
|
Admin customisation for Remittance
|
|
"""
|
|
list_display = ('user', 'valid',)
|
|
readonly_fields = ('transactions', 'credit_transaction',)
|
|
|
|
def has_add_permission(self, request):
|
|
# Don't create a credit manually
|
|
return False
|