1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
from django.shortcuts import render
from postgresqleu.util.backendviews import backend_list_editor
from postgresqleu.util.auth import authenticate_backend_group
from postgresqleu.util.db import exec_to_dict
from postgresqleu.accounting.backendforms import BackendAccountClassForm
from postgresqleu.accounting.backendforms import BackendAccountGroupForm
from postgresqleu.accounting.backendforms import BackendAccountForm
from postgresqleu.accounting.backendforms import BackendObjectForm
def edit_accountclass(request, rest):
authenticate_backend_group(request, 'Accounting managers')
return backend_list_editor(request,
None,
BackendAccountClassForm,
rest,
bypass_conference_filter=True,
topadmin='Accounting',
return_url='/admin/',
)
def edit_accountgroup(request, rest):
authenticate_backend_group(request, 'Accounting managers')
return backend_list_editor(request,
None,
BackendAccountGroupForm,
rest,
bypass_conference_filter=True,
topadmin='Accounting',
return_url='/admin/',
)
def edit_account(request, rest):
authenticate_backend_group(request, 'Accounting managers')
return backend_list_editor(request,
None,
BackendAccountForm,
rest,
bypass_conference_filter=True,
topadmin='Accounting',
return_url='/admin/',
)
def edit_object(request, rest):
authenticate_backend_group(request, 'Accounting managers')
return backend_list_editor(request,
None,
BackendObjectForm,
rest,
bypass_conference_filter=True,
topadmin='Accounting',
return_url='/admin/',
)
def accountstructure(request):
authenticate_backend_group(request, 'Accounting managers')
accounts = exec_to_dict("""SELECT ac.id AS classid, ac.name AS classname, ac.inbalance,
ag.id AS groupid, ag.name AS groupname,
a.id AS accountid, a.num AS accountnum, a.name AS accountname
FROM accounting_accountclass ac
INNER JOIN accounting_accountgroup ag ON ag.accountclass_id=ac.id
INNER JOIN accounting_account a ON a.group_id=ag.id
ORDER BY a.num""")
return render(request, 'accounting/structure.html', {
'accounts': accounts,
'topadmin': 'Accounting',
'helplink': 'accounting',
})
|