Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nk20
Manage
Activity
Members
Labels
Plan
Issues
32
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BDE
nk20
Commits
ad2cc229
Commit
ad2cc229
authored
4 years ago
by
ynerant
Browse files
Options
Downloads
Patches
Plain Diff
Transactions are not invalidable if the user doesn't have the right to
parent
ae629b55
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!86
Pre-beta fixes
Pipeline
#8283
failed with stages
in 1 minute and 58 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/note/tables.py
+23
-5
23 additions, 5 deletions
apps/note/tables.py
apps/treasury/views.py
+1
-1
1 addition, 1 deletion
apps/treasury/views.py
with
24 additions
and
6 deletions
apps/note/tables.py
+
23
−
5
View file @
ad2cc229
...
...
@@ -8,6 +8,8 @@ from django.db.models import F
from
django.utils.html
import
format_html
from
django_tables2.utils
import
A
from
django.utils.translation
import
gettext_lazy
as
_
from
note_kfet.middlewares
import
get_current_authenticated_user
from
permission.backends
import
PermissionBackend
from
.models.notes
import
Alias
from
.models.transactions
import
Transaction
,
TransactionTemplate
...
...
@@ -52,14 +54,26 @@ class HistoryTable(tables.Table):
attrs
=
{
"
td
"
:
{
"
id
"
:
lambda
record
:
"
validate_
"
+
str
(
record
.
id
),
"
class
"
:
lambda
record
:
str
(
record
.
valid
).
lower
()
+
'
validate
'
,
"
class
"
:
lambda
record
:
str
(
record
.
valid
).
lower
()
+
(
'
validate
'
if
PermissionBackend
.
check_perm
(
get_current_authenticated_user
(),
"
note.change_transaction_invalidity_reason
"
,
record
)
else
''
),
"
data-toggle
"
:
"
tooltip
"
,
"
title
"
:
lambda
record
:
_
(
"
Click to invalidate
"
)
if
record
.
valid
else
_
(
"
Click to validate
"
),
"
onclick
"
:
lambda
record
:
'
de_validate(
'
+
str
(
record
.
id
)
+
'
,
'
+
str
(
record
.
valid
).
lower
()
+
'
)
'
,
"
title
"
:
lambda
record
:
(
_
(
"
Click to invalidate
"
)
if
record
.
valid
else
_
(
"
Click to validate
"
))
if
PermissionBackend
.
check_perm
(
get_current_authenticated_user
(),
"
note.change_transaction_invalidity_reason
"
,
record
)
else
None
,
"
onclick
"
:
lambda
record
:
'
de_validate(
'
+
str
(
record
.
id
)
+
'
,
'
+
str
(
record
.
valid
).
lower
()
+
'
)
'
if
PermissionBackend
.
check_perm
(
get_current_authenticated_user
(),
"
note.change_transaction_invalidity_reason
"
,
record
)
else
None
,
"
onmouseover
"
:
lambda
record
:
'
$(
"
#invalidity_reason_
'
+
str
(
record
.
id
)
+
'"
).show();$(
"
#invalidity_reason_
'
+
str
(
record
.
id
)
+
'"
).focus();
'
,
"
onmouseout
"
:
lambda
record
:
'
$(
"
#invalidity_reason_
'
+
str
(
record
.
id
)
+
'"
).hide()
'
,
+
str
(
record
.
id
)
+
'"
).focus();
'
if
PermissionBackend
.
check_perm
(
get_current_authenticated_user
(),
"
note.change_transaction_invalidity_reason
"
,
record
)
else
None
,
"
onmouseout
"
:
lambda
record
:
'
$(
"
#invalidity_reason_
'
+
str
(
record
.
id
)
+
'"
).hide()
'
if
PermissionBackend
.
check_perm
(
get_current_authenticated_user
(),
"
note.change_transaction_invalidity_reason
"
,
record
)
else
None
,
}
}
)
...
...
@@ -88,6 +102,10 @@ class HistoryTable(tables.Table):
When the validation status is hovered, an input field is displayed to let the user specify an invalidity reason
"""
val
=
"
✔
"
if
value
else
"
✖
"
if
not
PermissionBackend
\
.
check_perm
(
get_current_authenticated_user
(),
"
note.change_transaction_invalidity_reason
"
,
record
):
return
val
val
+=
"
<input type=
'
text
'
class=
'
form-control
'
id=
'
invalidity_reason_
"
+
str
(
record
.
id
)
\
+
"'
value=
'"
+
(
html
.
escape
(
record
.
invalidity_reason
)
if
record
.
invalidity_reason
else
(
""
if
value
else
str
(
_
(
"
No reason specified
"
))))
\
...
...
This diff is collapsed.
Click to expand it.
apps/treasury/views.py
+
1
−
1
View file @
ad2cc229
...
...
@@ -171,7 +171,7 @@ class InvoiceRenderView(LoginRequiredMixin, View):
del
tex
# The file has to be rendered twice
for
_
in
range
(
2
):
for
ignored
in
range
(
2
):
error
=
subprocess
.
Popen
(
[
"
pdflatex
"
,
"
invoice-{}.tex
"
.
format
(
pk
)],
cwd
=
tmp_dir
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment