Fix #65 -- Disallow None value for product default prices (#3847)

* Fix #65 -- Disallow None value for product default prices

* Fix #65 -- Disallow None value for product default prices

* Rebase migration
This commit is contained in:
Raphael Michel
2024-02-28 16:10:53 +01:00
committed by GitHub
parent a5d4434a64
commit 04ef097eb1
3 changed files with 21 additions and 2 deletions
@@ -0,0 +1,19 @@
# Generated by Django 4.2.9 on 2024-01-30 11:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("pretixbase", "0256_itemvariation_unavail_modes"),
]
operations = [
migrations.AlterField(
model_name="item",
name="default_price",
field=models.DecimalField(decimal_places=2, default=0, max_digits=13),
preserve_default=False,
),
]
+1 -1
View File
@@ -430,7 +430,7 @@ class Item(LoggedModel):
help_text=_("If this product has multiple variations, you can set different prices for each of the "
"variations. If a variation does not have a special price or if you do not have variations, "
"this price will be used."),
max_digits=13, decimal_places=2, null=True
max_digits=13, decimal_places=2,
)
free_price = models.BooleanField(
default=False,
+1 -1
View File
@@ -934,7 +934,7 @@ def test_cartpos_create_with_voucher_unknown(token_client, organizer, event, ite
@pytest.mark.django_db
def test_cartpos_create_with_voucher_invalid_item(token_client, organizer, event, item, quota):
with scopes_disabled():
item2 = event.items.create(name="item2")
item2 = event.items.create(name="item2", default_price=0)
voucher = event.vouchers.create(code="FOOBAR", item=item2)
res = copy.deepcopy(CARTPOS_CREATE_PAYLOAD)
res['item'] = item.pk