mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-21 18:08:21 +02:00
Add some tables for special transactions
This commit is contained in:
@ -4,6 +4,8 @@
|
||||
import django_tables2 as tables
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django_tables2 import A
|
||||
from note.models import SpecialTransaction
|
||||
from note.templatetags.pretty_money import pretty_money
|
||||
|
||||
from .models import Invoice, Remittance
|
||||
|
||||
@ -33,6 +35,14 @@ class InvoiceTable(tables.Table):
|
||||
|
||||
|
||||
class RemittanceTable(tables.Table):
|
||||
edit = tables.LinkColumn("treasury:remittance_update",
|
||||
verbose_name=_("Edit"),
|
||||
args=[A("pk")],
|
||||
text=_("Edit"),
|
||||
attrs={
|
||||
'a': {'class': 'btn btn-primary'}
|
||||
}, )
|
||||
|
||||
class Meta:
|
||||
attrs = {
|
||||
'class': 'table table-condensed table-striped table-hover'
|
||||
@ -40,3 +50,32 @@ class RemittanceTable(tables.Table):
|
||||
model = Remittance
|
||||
template_name = 'django_tables2/bootstrap4.html'
|
||||
fields = ('id', 'date', 'type', 'comment', 'size', 'amount', 'edit',)
|
||||
|
||||
|
||||
class SpecialTransactionTable(tables.Table):
|
||||
remittance_add = tables.LinkColumn("treasury:remittance_update",
|
||||
verbose_name=_("Remittance"),
|
||||
args=[A("pk")],
|
||||
text=_("Add"),
|
||||
attrs={
|
||||
'a': {'class': 'btn btn-primary'}
|
||||
}, )
|
||||
|
||||
remittance_remove = tables.LinkColumn("treasury:remittance_update",
|
||||
verbose_name=_("Remittance"),
|
||||
args=[A("pk")],
|
||||
text=_("Remove"),
|
||||
attrs={
|
||||
'a': {'class': 'btn btn-primary btn-danger'}
|
||||
}, )
|
||||
|
||||
def render_amount(self, value):
|
||||
return pretty_money(value)
|
||||
|
||||
class Meta:
|
||||
attrs = {
|
||||
'class': 'table table-condensed table-striped table-hover'
|
||||
}
|
||||
model = SpecialTransaction
|
||||
template_name = 'django_tables2/bootstrap4.html'
|
||||
fields = ('id', 'source', 'destination', 'amount', 'last_name', 'first_name', 'bank',)
|
||||
|
Reference in New Issue
Block a user