Skip to content

Commit 6e9191b

Browse files
committed
fix: firmatecknare can edit invoices
1 parent 25d5153 commit 6e9191b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

expenses/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ def may_delete_expense(self, expense):
195195
or expense.owner.user.username == self.user.username
196196
)
197197

198+
def may_edit_invoice(self):
199+
return dauth.has_unscoped_permission("edit-invoice", self.user)
200+
198201
def may_delete_invoice(self, invoice):
199202
if invoice.is_payed():
200203
return False

templates/invoices/show.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{% endblock %}
77

88
{% block action %}
9-
{% if user.username == invoice.owner.user.username or user.profile.firmatecknare %}
9+
{% if user.username == invoice.owner.user.username or user.profile.may_edit_invoice %}
1010
<a href="{% url 'invoices-edit' invoice.id %}" class="primary-action" style="padding-top: 10px; padding-bottom: 8px; padding-left: 15px; padding-right: 15px;">
1111
Redigera faktura
1212
</a>

0 commit comments

Comments
 (0)