mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-04-23 09:08:39 +02: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.common.decorators.htmx import only_htmx
|
||||||
from apps.transactions.models import Transaction
|
from apps.transactions.models import Transaction
|
||||||
|
from apps.rules.signals import transaction_updated
|
||||||
|
|
||||||
|
|
||||||
@only_htmx
|
@only_htmx
|
||||||
@@ -17,6 +18,9 @@ def bulk_pay_transactions(request):
|
|||||||
count = transactions.count()
|
count = transactions.count()
|
||||||
transactions.update(is_paid=True)
|
transactions.update(is_paid=True)
|
||||||
|
|
||||||
|
for transaction in transactions:
|
||||||
|
transaction_updated.send(sender=transaction)
|
||||||
|
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
ngettext_lazy(
|
ngettext_lazy(
|
||||||
@@ -41,6 +45,9 @@ def bulk_unpay_transactions(request):
|
|||||||
count = transactions.count()
|
count = transactions.count()
|
||||||
transactions.update(is_paid=False)
|
transactions.update(is_paid=False)
|
||||||
|
|
||||||
|
for transaction in transactions:
|
||||||
|
transaction_updated.send(sender=transaction)
|
||||||
|
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
ngettext_lazy(
|
ngettext_lazy(
|
||||||
|
|||||||
@@ -316,6 +316,7 @@ def transaction_pay(request, transaction_id):
|
|||||||
new_is_paid = False if transaction.is_paid else True
|
new_is_paid = False if transaction.is_paid else True
|
||||||
transaction.is_paid = new_is_paid
|
transaction.is_paid = new_is_paid
|
||||||
transaction.save()
|
transaction.save()
|
||||||
|
transaction_updated.send(sender=transaction)
|
||||||
|
|
||||||
response = render(
|
response = render(
|
||||||
request,
|
request,
|
||||||
|
|||||||
Reference in New Issue
Block a user