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_active = now() - settings.SITH_ACCOUNT_INACTIVITY_DELTA + timedelta(days=1)
|
||||||
time_inactive = time_active - timedelta(days=3)
|
time_inactive = time_active - timedelta(days=3)
|
||||||
counter, seller = baker.make(Counter), baker.make(User)
|
counter, seller = baker.make(Counter), baker.make(User)
|
||||||
sale_recipe = Recipe(
|
sale_recipe = Recipe(Selling, counter=counter, club=counter.club, seller=seller)
|
||||||
Selling,
|
|
||||||
counter=counter,
|
|
||||||
club=counter.club,
|
|
||||||
seller=seller,
|
|
||||||
is_validated=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
cls.users = [
|
cls.users = [
|
||||||
baker.make(User),
|
baker.make(User),
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ class Command(BaseCommand):
|
|||||||
quantity=1,
|
quantity=1,
|
||||||
unit_price=account.amount,
|
unit_price=account.amount,
|
||||||
date=now(),
|
date=now(),
|
||||||
is_validated=True,
|
|
||||||
)
|
)
|
||||||
for account in accounts
|
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"))],
|
choices=[("SITH_ACCOUNT", _("Sith account")), ("CARD", _("Credit card"))],
|
||||||
default="SITH_ACCOUNT",
|
default="SITH_ACCOUNT",
|
||||||
)
|
)
|
||||||
is_validated = models.BooleanField(_("is validated"), default=False)
|
|
||||||
|
|
||||||
objects = SellingQuerySet.as_manager()
|
objects = SellingQuerySet.as_manager()
|
||||||
|
|
||||||
@@ -875,10 +874,9 @@ class Selling(models.Model):
|
|||||||
if not self.date:
|
if not self.date:
|
||||||
self.date = timezone.now()
|
self.date = timezone.now()
|
||||||
self.full_clean()
|
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.amount -= self.quantity * self.unit_price
|
||||||
self.customer.save(allow_negative=allow_negative)
|
self.customer.save(allow_negative=allow_negative)
|
||||||
self.is_validated = True
|
|
||||||
user = self.customer.user
|
user = self.customer.user
|
||||||
if user.was_subscribed:
|
if user.was_subscribed:
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -116,7 +116,6 @@ class TestAccountDumpCommand(TestAccountDump):
|
|||||||
operation: Selling = customer.buyings.order_by("date").last()
|
operation: Selling = customer.buyings.order_by("date").last()
|
||||||
assert operation.unit_price == initial_amount
|
assert operation.unit_price == initial_amount
|
||||||
assert operation.counter_id == settings.SITH_COUNTER_ACCOUNT_DUMP_ID
|
assert operation.counter_id == settings.SITH_COUNTER_ACCOUNT_DUMP_ID
|
||||||
assert operation.is_validated is True
|
|
||||||
dump = customer.dumps.last()
|
dump = customer.dumps.last()
|
||||||
assert dump.dump_operation == operation
|
assert dump.dump_operation == operation
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ class InvoiceCallView(
|
|||||||
kwargs["sum_cb"] += (
|
kwargs["sum_cb"] += (
|
||||||
Selling.objects.filter(
|
Selling.objects.filter(
|
||||||
payment_method="CARD",
|
payment_method="CARD",
|
||||||
is_validated=True,
|
|
||||||
date__gte=start_date,
|
date__gte=start_date,
|
||||||
date__lte=end_date,
|
date__lte=end_date,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -268,7 +268,6 @@ class Invoice(models.Model):
|
|||||||
unit_price=i.product_unit_price,
|
unit_price=i.product_unit_price,
|
||||||
quantity=i.quantity,
|
quantity=i.quantity,
|
||||||
payment_method="CARD",
|
payment_method="CARD",
|
||||||
is_validated=True,
|
|
||||||
date=self.date,
|
date=self.date,
|
||||||
)
|
)
|
||||||
new.save()
|
new.save()
|
||||||
|
|||||||
@@ -108,10 +108,13 @@ def test_eboutic_basket_expiry(
|
|||||||
|
|
||||||
client.force_login(customer.user)
|
client.force_login(customer.user)
|
||||||
|
|
||||||
for date in sellings:
|
sale_recipe.make(
|
||||||
sale_recipe.make(
|
customer=customer,
|
||||||
customer=customer, counter=eboutic, date=date, is_validated=True
|
counter=eboutic,
|
||||||
)
|
date=iter(sellings),
|
||||||
|
_quantity=len(sellings),
|
||||||
|
_bulk_create=True,
|
||||||
|
)
|
||||||
for date in refillings:
|
for date in refillings:
|
||||||
refill_recipe.make(customer=customer, counter=eboutic, date=date)
|
refill_recipe.make(customer=customer, counter=eboutic, date=date)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user