mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-03-22 09:29:30 +01:00
Merge pull request #156 from eitchtee/dev
fix(transactions): paying transaction doesn't trigger update rules
This commit is contained in:
@@ -7,6 +7,7 @@ from django.utils.translation import gettext_lazy as _, ngettext_lazy
|
||||
|
||||
from apps.common.decorators.htmx import only_htmx
|
||||
from apps.transactions.models import Transaction
|
||||
from apps.rules.signals import transaction_updated
|
||||
|
||||
|
||||
@only_htmx
|
||||
@@ -17,6 +18,9 @@ def bulk_pay_transactions(request):
|
||||
count = transactions.count()
|
||||
transactions.update(is_paid=True)
|
||||
|
||||
for transaction in transactions:
|
||||
transaction_updated.send(sender=transaction)
|
||||
|
||||
messages.success(
|
||||
request,
|
||||
ngettext_lazy(
|
||||
@@ -41,6 +45,9 @@ def bulk_unpay_transactions(request):
|
||||
count = transactions.count()
|
||||
transactions.update(is_paid=False)
|
||||
|
||||
for transaction in transactions:
|
||||
transaction_updated.send(sender=transaction)
|
||||
|
||||
messages.success(
|
||||
request,
|
||||
ngettext_lazy(
|
||||
|
||||
@@ -316,6 +316,7 @@ def transaction_pay(request, transaction_id):
|
||||
new_is_paid = False if transaction.is_paid else True
|
||||
transaction.is_paid = new_is_paid
|
||||
transaction.save()
|
||||
transaction_updated.send(sender=transaction)
|
||||
|
||||
response = render(
|
||||
request,
|
||||
|
||||
Reference in New Issue
Block a user