mirror of
https://github.com/ae-utbm/sith.git
synced 2025-11-22 12:46:58 +00:00
remove Selling.is_validated
This commit is contained in:
@@ -186,13 +186,7 @@ class TestFilterInactive(TestCase):
|
||||
time_active = now() - settings.SITH_ACCOUNT_INACTIVITY_DELTA + timedelta(days=1)
|
||||
time_inactive = time_active - timedelta(days=3)
|
||||
counter, seller = baker.make(Counter), baker.make(User)
|
||||
sale_recipe = Recipe(
|
||||
Selling,
|
||||
counter=counter,
|
||||
club=counter.club,
|
||||
seller=seller,
|
||||
is_validated=True,
|
||||
)
|
||||
sale_recipe = Recipe(Selling, counter=counter, club=counter.club, seller=seller)
|
||||
|
||||
cls.users = [
|
||||
baker.make(User),
|
||||
|
||||
@@ -119,7 +119,6 @@ class Command(BaseCommand):
|
||||
quantity=1,
|
||||
unit_price=account.amount,
|
||||
date=now(),
|
||||
is_validated=True,
|
||||
)
|
||||
for account in accounts
|
||||
]
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# Generated by Django 5.2.8 on 2025-11-19 17:59
|
||||
|
||||
from django.db import migrations, models
|
||||
from django.db.migrations.state import StateApps
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [("counter", "0034_alter_selling_date_selling_date_month_idx")]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(model_name="selling", name="is_validated"),
|
||||
]
|
||||
@@ -856,7 +856,6 @@ class Selling(models.Model):
|
||||
choices=[("SITH_ACCOUNT", _("Sith account")), ("CARD", _("Credit card"))],
|
||||
default="SITH_ACCOUNT",
|
||||
)
|
||||
is_validated = models.BooleanField(_("is validated"), default=False)
|
||||
|
||||
objects = SellingQuerySet.as_manager()
|
||||
|
||||
@@ -875,10 +874,9 @@ class Selling(models.Model):
|
||||
if not self.date:
|
||||
self.date = timezone.now()
|
||||
self.full_clean()
|
||||
if not self.is_validated:
|
||||
if self._state.adding and self.payment_method == "SITH_ACCOUNT":
|
||||
self.customer.amount -= self.quantity * self.unit_price
|
||||
self.customer.save(allow_negative=allow_negative)
|
||||
self.is_validated = True
|
||||
user = self.customer.user
|
||||
if user.was_subscribed:
|
||||
if (
|
||||
|
||||
@@ -116,7 +116,6 @@ class TestAccountDumpCommand(TestAccountDump):
|
||||
operation: Selling = customer.buyings.order_by("date").last()
|
||||
assert operation.unit_price == initial_amount
|
||||
assert operation.counter_id == settings.SITH_COUNTER_ACCOUNT_DUMP_ID
|
||||
assert operation.is_validated is True
|
||||
dump = customer.dumps.last()
|
||||
assert dump.dump_operation == operation
|
||||
|
||||
|
||||
@@ -75,7 +75,6 @@ class InvoiceCallView(
|
||||
kwargs["sum_cb"] += (
|
||||
Selling.objects.filter(
|
||||
payment_method="CARD",
|
||||
is_validated=True,
|
||||
date__gte=start_date,
|
||||
date__lte=end_date,
|
||||
)
|
||||
|
||||
@@ -268,7 +268,6 @@ class Invoice(models.Model):
|
||||
unit_price=i.product_unit_price,
|
||||
quantity=i.quantity,
|
||||
payment_method="CARD",
|
||||
is_validated=True,
|
||||
date=self.date,
|
||||
)
|
||||
new.save()
|
||||
|
||||
@@ -108,10 +108,13 @@ def test_eboutic_basket_expiry(
|
||||
|
||||
client.force_login(customer.user)
|
||||
|
||||
for date in sellings:
|
||||
sale_recipe.make(
|
||||
customer=customer, counter=eboutic, date=date, is_validated=True
|
||||
)
|
||||
sale_recipe.make(
|
||||
customer=customer,
|
||||
counter=eboutic,
|
||||
date=iter(sellings),
|
||||
_quantity=len(sellings),
|
||||
_bulk_create=True,
|
||||
)
|
||||
for date in refillings:
|
||||
refill_recipe.make(customer=customer, counter=eboutic, date=date)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user