Changed the permission to the offset matcher so that editors can use it.
This commit is contained in:
parent
1218b224fc
commit
df240472a4
@ -34,7 +34,7 @@ from accounting.report.utils.unapplied import get_accounts_with_unapplied
|
||||
from accounting.report.utils.urls import unapplied_url
|
||||
from accounting.utils.offset_matcher import OffsetMatcher
|
||||
from accounting.utils.pagination import Pagination
|
||||
from accounting.utils.permission import can_admin
|
||||
from accounting.utils.permission import can_edit
|
||||
|
||||
|
||||
class CSVRow(BaseCSVRow):
|
||||
@ -158,7 +158,7 @@ class UnappliedOriginalLineItems(BaseReport):
|
||||
= offset_matcher.unapplied
|
||||
"""The line items."""
|
||||
self.__is_mark_matches: bool \
|
||||
= can_admin() and len(offset_matcher.unmatched_offsets) > 0
|
||||
= can_edit() and len(offset_matcher.unmatched_offsets) > 0
|
||||
"""Whether to mark the matched offsets."""
|
||||
|
||||
def csv(self) -> Response:
|
||||
|
@ -51,6 +51,12 @@ First written: 2023/1/26
|
||||
{{ A_("Currencies") }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item {% if request.endpoint and request.endpoint.startswith("accounting.unmatched-offset.") %} active {% endif %}" href="{{ url_for("accounting.unmatched-offset.dashboard") }}">
|
||||
<i class="fa-solid fa-link-slash"></i>
|
||||
{{ A_("Unmatched Offsets") }}
|
||||
</a>
|
||||
</li>
|
||||
{% if accounting_can_admin() %}
|
||||
<li>
|
||||
<a class="dropdown-item {% if request.endpoint and request.endpoint.startswith("accounting.option.") %} active {% endif %}" href="{{ url_for("accounting.option.detail") }}">
|
||||
@ -58,12 +64,6 @@ First written: 2023/1/26
|
||||
{{ A_("Settings") }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item {% if request.endpoint and request.endpoint.startswith("accounting.unmatched-offset.") %} active {% endif %}" href="{{ url_for("accounting.unmatched-offset.dashboard") }}">
|
||||
<i class="fa-solid fa-link-slash"></i>
|
||||
{{ A_("Unmatched Offsets") }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</li>
|
||||
|
@ -25,7 +25,7 @@ from accounting.models import JournalEntryLineItem, Account
|
||||
from accounting.utils.cast import s
|
||||
from accounting.utils.offset_matcher import OffsetMatcher
|
||||
from accounting.utils.pagination import Pagination
|
||||
from accounting.utils.permission import has_permission, can_admin
|
||||
from accounting.utils.permission import has_permission, can_edit
|
||||
from .queries import get_accounts_with_unmatched_offsets
|
||||
|
||||
bp: Blueprint = Blueprint("unmatched-offset", __name__)
|
||||
@ -33,7 +33,7 @@ bp: Blueprint = Blueprint("unmatched-offset", __name__)
|
||||
|
||||
|
||||
@bp.get("", endpoint="dashboard")
|
||||
@has_permission(can_admin)
|
||||
@has_permission(can_edit)
|
||||
def show_offset_dashboard() -> str:
|
||||
"""Shows the dashboard about offsets.
|
||||
|
||||
@ -44,7 +44,7 @@ def show_offset_dashboard() -> str:
|
||||
|
||||
|
||||
@bp.get("<needOffsetAccount:account>", endpoint="list")
|
||||
@has_permission(can_admin)
|
||||
@has_permission(can_edit)
|
||||
def show_unmatched_offsets(account: Account) -> str:
|
||||
"""Shows the unmatched offsets in an account.
|
||||
|
||||
@ -60,7 +60,7 @@ def show_unmatched_offsets(account: Account) -> str:
|
||||
|
||||
|
||||
@bp.post("<needOffsetAccount:account>", endpoint="match")
|
||||
@has_permission(can_admin)
|
||||
@has_permission(can_edit)
|
||||
def match_offsets(account: Account) -> redirect:
|
||||
"""Matches the original line items with their offsets.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user