mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-10 00:03:24 +00:00
fix: CashRegisterSummaryItem.check overriding a django method
This commit is contained in:
parent
507080f75e
commit
ae1fcdb8c0
@ -0,0 +1,24 @@
|
|||||||
|
# Generated by Django 4.2 on 2024-06-26 09:26
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [("counter", "0020_auto_20221215_1709")]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name="cashregistersummaryitem",
|
||||||
|
old_name="check",
|
||||||
|
new_name="is_check",
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="cashregistersummaryitem",
|
||||||
|
name="is_check",
|
||||||
|
field=models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
help_text="True if this is a bank check, else False",
|
||||||
|
verbose_name="check",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
@ -927,25 +927,25 @@ class CashRegisterSummary(models.Model):
|
|||||||
if name[:5] == "check":
|
if name[:5] == "check":
|
||||||
checks = self.items.filter(check=True).order_by("value").all()
|
checks = self.items.filter(check=True).order_by("value").all()
|
||||||
if name == "ten_cents":
|
if name == "ten_cents":
|
||||||
return self.items.filter(value=0.1, check=False).first()
|
return self.items.filter(value=0.1, is_check=False).first()
|
||||||
elif name == "twenty_cents":
|
elif name == "twenty_cents":
|
||||||
return self.items.filter(value=0.2, check=False).first()
|
return self.items.filter(value=0.2, is_check=False).first()
|
||||||
elif name == "fifty_cents":
|
elif name == "fifty_cents":
|
||||||
return self.items.filter(value=0.5, check=False).first()
|
return self.items.filter(value=0.5, is_check=False).first()
|
||||||
elif name == "one_euro":
|
elif name == "one_euro":
|
||||||
return self.items.filter(value=1, check=False).first()
|
return self.items.filter(value=1, is_check=False).first()
|
||||||
elif name == "two_euros":
|
elif name == "two_euros":
|
||||||
return self.items.filter(value=2, check=False).first()
|
return self.items.filter(value=2, is_check=False).first()
|
||||||
elif name == "five_euros":
|
elif name == "five_euros":
|
||||||
return self.items.filter(value=5, check=False).first()
|
return self.items.filter(value=5, is_check=False).first()
|
||||||
elif name == "ten_euros":
|
elif name == "ten_euros":
|
||||||
return self.items.filter(value=10, check=False).first()
|
return self.items.filter(value=10, is_check=False).first()
|
||||||
elif name == "twenty_euros":
|
elif name == "twenty_euros":
|
||||||
return self.items.filter(value=20, check=False).first()
|
return self.items.filter(value=20, is_check=False).first()
|
||||||
elif name == "fifty_euros":
|
elif name == "fifty_euros":
|
||||||
return self.items.filter(value=50, check=False).first()
|
return self.items.filter(value=50, is_check=False).first()
|
||||||
elif name == "hundred_euros":
|
elif name == "hundred_euros":
|
||||||
return self.items.filter(value=100, check=False).first()
|
return self.items.filter(value=100, is_check=False).first()
|
||||||
elif name == "check_1":
|
elif name == "check_1":
|
||||||
return checks[0] if 0 < len(checks) else None
|
return checks[0] if 0 < len(checks) else None
|
||||||
elif name == "check_2":
|
elif name == "check_2":
|
||||||
@ -993,7 +993,11 @@ class CashRegisterSummaryItem(models.Model):
|
|||||||
)
|
)
|
||||||
value = CurrencyField(_("value"))
|
value = CurrencyField(_("value"))
|
||||||
quantity = models.IntegerField(_("quantity"), default=0)
|
quantity = models.IntegerField(_("quantity"), default=0)
|
||||||
check = models.BooleanField(_("check"), default=False)
|
is_check = models.BooleanField(
|
||||||
|
_("check"),
|
||||||
|
default=False,
|
||||||
|
help_text=_("True if this is a bank check, else False"),
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _("cash register summary item")
|
verbose_name = _("cash register summary item")
|
||||||
|
@ -1204,35 +1204,35 @@ class CashRegisterSummaryForm(forms.Form):
|
|||||||
cash_summary=summary,
|
cash_summary=summary,
|
||||||
value=cd["check_1_value"],
|
value=cd["check_1_value"],
|
||||||
quantity=cd["check_1_quantity"],
|
quantity=cd["check_1_quantity"],
|
||||||
check=True,
|
is_check=True,
|
||||||
).save()
|
).save()
|
||||||
if cd["check_2_quantity"]:
|
if cd["check_2_quantity"]:
|
||||||
CashRegisterSummaryItem(
|
CashRegisterSummaryItem(
|
||||||
cash_summary=summary,
|
cash_summary=summary,
|
||||||
value=cd["check_2_value"],
|
value=cd["check_2_value"],
|
||||||
quantity=cd["check_2_quantity"],
|
quantity=cd["check_2_quantity"],
|
||||||
check=True,
|
is_check=True,
|
||||||
).save()
|
).save()
|
||||||
if cd["check_3_quantity"]:
|
if cd["check_3_quantity"]:
|
||||||
CashRegisterSummaryItem(
|
CashRegisterSummaryItem(
|
||||||
cash_summary=summary,
|
cash_summary=summary,
|
||||||
value=cd["check_3_value"],
|
value=cd["check_3_value"],
|
||||||
quantity=cd["check_3_quantity"],
|
quantity=cd["check_3_quantity"],
|
||||||
check=True,
|
is_check=True,
|
||||||
).save()
|
).save()
|
||||||
if cd["check_4_quantity"]:
|
if cd["check_4_quantity"]:
|
||||||
CashRegisterSummaryItem(
|
CashRegisterSummaryItem(
|
||||||
cash_summary=summary,
|
cash_summary=summary,
|
||||||
value=cd["check_4_value"],
|
value=cd["check_4_value"],
|
||||||
quantity=cd["check_4_quantity"],
|
quantity=cd["check_4_quantity"],
|
||||||
check=True,
|
is_check=True,
|
||||||
).save()
|
).save()
|
||||||
if cd["check_5_quantity"]:
|
if cd["check_5_quantity"]:
|
||||||
CashRegisterSummaryItem(
|
CashRegisterSummaryItem(
|
||||||
cash_summary=summary,
|
cash_summary=summary,
|
||||||
value=cd["check_5_value"],
|
value=cd["check_5_value"],
|
||||||
quantity=cd["check_5_quantity"],
|
quantity=cd["check_5_quantity"],
|
||||||
check=True,
|
is_check=True,
|
||||||
).save()
|
).save()
|
||||||
if summary.items.count() < 1:
|
if summary.items.count() < 1:
|
||||||
summary.delete()
|
summary.delete()
|
||||||
|
Loading…
Reference in New Issue
Block a user