mirror of
https://github.com/pretix/pretix.git
synced 2026-08-21 12:36:26 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ea80066a2 | ||
|
|
db147280fd | ||
|
|
d1ce4566a7 | ||
|
|
c3cfd4ea91 | ||
|
|
92e7069a8e | ||
|
|
f471091d77 | ||
|
|
351d2055f8 |
Generated
+3
-3
@@ -2584,9 +2584,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/immutable": {
|
||||
"version": "5.1.5",
|
||||
"resolved": "https://registry.npmjs.org/immutable/-/immutable-5.1.5.tgz",
|
||||
"integrity": "sha512-t7xcm2siw+hlUM68I+UEOK+z84RzmN59as9DZ7P1l0994DKUWV7UXBMQZVxaoMSRQ+PBZbHCOoBt7a2wxOMt+A==",
|
||||
"version": "5.1.9",
|
||||
"resolved": "https://registry.npmjs.org/immutable/-/immutable-5.1.9.tgz",
|
||||
"integrity": "sha512-m8nVez3rwrgmWxtLMt1ZYXB2Lv7OKYn/disyxAlSDYAlKSlFoPPfIAmAM/M5xqL4m4C/wAPw7S2/CNaUii1Hxg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
|
||||
+2
-2
@@ -55,7 +55,7 @@ dependencies = [
|
||||
"django-phonenumber-field==8.4.*",
|
||||
"django-querytagger==0.0.3",
|
||||
"django-redis==7.0.*",
|
||||
"django-scopes==2.0.*",
|
||||
"django-scopes==2.1.*",
|
||||
"django-statici18n==2.7.*",
|
||||
"djangorestframework==3.17.*",
|
||||
"dnspython==2.8.*",
|
||||
@@ -112,7 +112,7 @@ dev = [
|
||||
"aiohttp==3.14.*",
|
||||
"coverage",
|
||||
"coveralls",
|
||||
"fakeredis==2.36.*",
|
||||
"fakeredis==2.37.*",
|
||||
"flake8==7.3.*",
|
||||
"freezegun",
|
||||
"isort==8.0.*",
|
||||
|
||||
@@ -508,20 +508,20 @@ class Order(LockModel, LoggedModel):
|
||||
|
||||
@classmethod
|
||||
def annotate_overpayments(cls, qs, results=True, refunds=True, sums=False):
|
||||
payment_sum = OrderPayment.objects.filter(
|
||||
payment_sum = OrderPayment.objects.with_scopes_disabled().filter(
|
||||
state__in=(OrderPayment.PAYMENT_STATE_CONFIRMED, OrderPayment.PAYMENT_STATE_REFUNDED),
|
||||
order=OuterRef('pk')
|
||||
).order_by().values('order').annotate(s=Sum('amount')).values('s')
|
||||
refund_sum = OrderRefund.objects.filter(
|
||||
refund_sum = OrderRefund.objects.with_scopes_disabled().filter(
|
||||
state__in=(OrderRefund.REFUND_STATE_DONE, OrderRefund.REFUND_STATE_TRANSIT,
|
||||
OrderRefund.REFUND_STATE_CREATED),
|
||||
order=OuterRef('pk')
|
||||
).order_by().values('order').annotate(s=Sum('amount')).values('s')
|
||||
external_refund = OrderRefund.objects.filter(
|
||||
external_refund = OrderRefund.objects.with_scopes_disabled().filter(
|
||||
state=OrderRefund.REFUND_STATE_EXTERNAL,
|
||||
order=OuterRef('pk')
|
||||
)
|
||||
pending_refund = OrderRefund.objects.filter(
|
||||
pending_refund = OrderRefund.objects.with_scopes_disabled().filter(
|
||||
state__in=(OrderRefund.REFUND_STATE_CREATED, OrderRefund.REFUND_STATE_TRANSIT),
|
||||
order=OuterRef('pk')
|
||||
)
|
||||
|
||||
@@ -53,6 +53,7 @@ from django.utils.translation import (
|
||||
)
|
||||
from django_scopes import scopes_disabled
|
||||
|
||||
from pretix.base.decimal import round_decimal
|
||||
from pretix.base.i18n import language
|
||||
from pretix.base.media import MEDIA_TYPES
|
||||
from pretix.base.models import (
|
||||
@@ -916,6 +917,8 @@ class CartManager:
|
||||
if custom_price > 99_999_999_999:
|
||||
raise CartError(error_messages['price_too_high'])
|
||||
|
||||
custom_price = round_decimal(custom_price, currency=self.event.currency)
|
||||
|
||||
op = self.AddOperation(
|
||||
count=i['count'],
|
||||
item=item,
|
||||
@@ -1038,6 +1041,8 @@ class CartManager:
|
||||
if custom_price > 99_999_999_999:
|
||||
raise CartError(error_messages['price_too_high'])
|
||||
|
||||
custom_price = round_decimal(custom_price, currency=self.event.currency)
|
||||
|
||||
# Fix positions with wrong price (TODO: happens out-of-cartmanager-transaction and therefore a little hacky)
|
||||
for ca in current_addons[cp][a['item'], a['variation']]:
|
||||
if ca.listed_price != listed_price:
|
||||
|
||||
@@ -66,5 +66,5 @@
|
||||
</div>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% include "pretixcontrol/pagination.html" %}
|
||||
{% include "pretixcontrol/pagination_huge.html" %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -64,5 +64,5 @@
|
||||
</div>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% include "pretixcontrol/pagination.html" %}
|
||||
{% include "pretixcontrol/pagination_huge.html" %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -121,7 +121,7 @@ from ...helpers.format import (
|
||||
)
|
||||
from ..forms.filter import LogFilterForm
|
||||
from ..logdisplay import OVERVIEW_BANLIST
|
||||
from . import CreateView, PaginationMixin, UpdateView
|
||||
from . import CreateView, LargeResultSetPaginator, PaginationMixin, UpdateView
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -1254,6 +1254,7 @@ class EventDelete(RecentAuthenticationRequiredMixin, EventPermissionRequiredMixi
|
||||
class EventLog(EventPermissionRequiredMixin, PaginationMixin, ListView):
|
||||
template_name = 'pretixcontrol/event/logs.html'
|
||||
model = LogEntry
|
||||
paginator_class = LargeResultSetPaginator
|
||||
context_object_name = 'logs'
|
||||
|
||||
def get_queryset(self):
|
||||
|
||||
@@ -134,7 +134,7 @@ from pretix.control.permissions import (
|
||||
organizer_permission_required,
|
||||
)
|
||||
from pretix.control.signals import nav_organizer
|
||||
from pretix.control.views import PaginationMixin
|
||||
from pretix.control.views import LargeResultSetPaginator, PaginationMixin
|
||||
from pretix.control.views.mailsetup import MailSettingsSetupView
|
||||
from pretix.helpers import OF_SELF, GroupConcat
|
||||
from pretix.helpers.compat import CompatDeleteView
|
||||
@@ -2664,6 +2664,7 @@ class LogView(OrganizerPermissionRequiredMixin, PaginationMixin, ListView):
|
||||
template_name = 'pretixcontrol/organizers/logs.html'
|
||||
permission = 'organizer.settings.general:write'
|
||||
model = LogEntry
|
||||
paginator_class = LargeResultSetPaginator
|
||||
context_object_name = 'logs'
|
||||
|
||||
def get_queryset(self):
|
||||
|
||||
+7492
-4883
File diff suppressed because it is too large
Load Diff
@@ -697,6 +697,42 @@ class CartTest(CartTestMixin, TestCase):
|
||||
self.assertIsNone(objs[0].variation)
|
||||
self.assertEqual(objs[0].price, 23)
|
||||
|
||||
def test_free_price_rounding(self):
|
||||
self.ticket.free_price = True
|
||||
self.ticket.save()
|
||||
|
||||
response = self.client.post('/%s/%s/cart/add' % (self.orga.slug, self.event.slug), {
|
||||
'item_%d' % self.ticket.id: '1',
|
||||
'price_%d' % self.ticket.id: '40.1234',
|
||||
}, follow=True)
|
||||
self.assertRedirects(response, '/%s/%s/?require_cookie=true' % (self.orga.slug, self.event.slug),
|
||||
target_status_code=200)
|
||||
|
||||
with scopes_disabled():
|
||||
cr1 = CartPosition.objects.get()
|
||||
assert cr1.listed_price == Decimal('23.00')
|
||||
assert cr1.custom_price_input == Decimal('40.12')
|
||||
assert cr1.price == Decimal('40.12')
|
||||
|
||||
def test_free_price_rounding_jpy(self):
|
||||
self.event.currency = "JPY"
|
||||
self.event.save()
|
||||
self.ticket.free_price = True
|
||||
self.ticket.save()
|
||||
|
||||
response = self.client.post('/%s/%s/cart/add' % (self.orga.slug, self.event.slug), {
|
||||
'item_%d' % self.ticket.id: '1',
|
||||
'price_%d' % self.ticket.id: '40.1234',
|
||||
}, follow=True)
|
||||
self.assertRedirects(response, '/%s/%s/?require_cookie=true' % (self.orga.slug, self.event.slug),
|
||||
target_status_code=200)
|
||||
|
||||
with scopes_disabled():
|
||||
cr1 = CartPosition.objects.get()
|
||||
assert cr1.listed_price == Decimal('23.00')
|
||||
assert cr1.custom_price_input == Decimal('40.00')
|
||||
assert cr1.price == Decimal('40.00')
|
||||
|
||||
def test_variation_inactive(self):
|
||||
self.shirt_red.active = False
|
||||
self.shirt_red.save()
|
||||
@@ -3060,6 +3096,31 @@ class CartAddonTest(CartTestMixin, TestCase):
|
||||
assert cp1.addons.count() == 3
|
||||
assert all(a.price == Decimal('12.00') for a in cp1.addons.all())
|
||||
|
||||
@classscope(attr='orga')
|
||||
def test_free_price_rounding(self):
|
||||
self.event.settings.locales = ['de']
|
||||
self.event.settings.locale = 'de'
|
||||
self.event.currency = "JPY"
|
||||
self.event.save()
|
||||
|
||||
self.workshop1.free_price = True
|
||||
self.workshop1.save()
|
||||
cp1 = CartPosition.objects.create(
|
||||
event=self.event, cart_id=self.session_key, item=self.ticket,
|
||||
price=23, expires=now() - timedelta(minutes=10)
|
||||
)
|
||||
|
||||
response = self.client.post('/%s/%s/checkout/addons/' % (self.orga.slug, self.event.slug), {
|
||||
'cp_{}_item_{}'.format(cp1.pk, self.workshop1.pk): '1',
|
||||
'cp_{}_item_{}_price'.format(cp1.pk, self.workshop1.pk): '99,99',
|
||||
}, follow=True)
|
||||
self.assertRedirects(response, '/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug),
|
||||
target_status_code=200)
|
||||
with scopes_disabled():
|
||||
assert cp1.addons.count() == 1
|
||||
assert cp1.addons.first().item == self.workshop1
|
||||
assert cp1.addons.first().price == Decimal('100')
|
||||
|
||||
@classscope(attr='orga')
|
||||
def test_change_number(self):
|
||||
cp1 = CartPosition.objects.create(
|
||||
|
||||
Reference in New Issue
Block a user