Revert Bambu Lab cart and price allocation changes

This commit is contained in:
Mikei386 committed 2026-11-26 21:31:26 +01:00
1 parent 8806fc85e5
commit 9f07b07bb7
12 files changed
+7 -1090

No files matched your search

-21
View File
@@ -405,8 +405,6 @@ class StockMovement(models.Model):
class OrderItem(QuantityPosition):
EU_CART_QUOTE_PREFIX = "eu-cart:"
class Status(models.TextChoices):
OPEN = "open", "Offen"
UNAVAILABLE = "unavailable", "Aktuell nicht verfügbar"
@@ -426,10 +424,6 @@ class OrderItem(QuantityPosition):
handover_remainder = models.ForeignKey(
"self", on_delete=models.SET_NULL, null=True, blank=True, related_name="+"
)
bambu_quote_cents = models.PositiveIntegerField(null=True, editable=False)
bambu_quote_quantity = models.PositiveSmallIntegerField(null=True, editable=False)
bambu_quote_signature = models.CharField(max_length=64, blank=True, editable=False)
bambu_quoted_at = models.DateTimeField(null=True, editable=False)
class Meta(QuantityPosition.Meta):
constraints = [
@@ -454,21 +448,6 @@ class OrderItem(QuantityPosition):
def is_pending(self):
return self.status in self.PENDING_STATUSES
@property
def bambu_line_total(self):
if (
self.bambu_quote_cents is not None
and self.quantity == self.bambu_quote_quantity
and self.bambu_quote_signature.startswith(self.EU_CART_QUOTE_PREFIX)
):
return Decimal(self.bambu_quote_cents) / 100
return None
@property
def bambu_unit_price(self):
total = self.bambu_line_total
return total / self.quantity if total is not None else None
class Printer(models.Model):
owner = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)