Make counter click client side first

This commit is contained in:
2024-12-20 17:32:37 +01:00
parent eaac0c728f
commit 60f18669c8
6 changed files with 342 additions and 423 deletions

View File

@ -327,6 +327,8 @@ class ProductType(OrderedModel):
class Product(models.Model):
"""A product, with all its related information."""
QUANTITY_FOR_TRAY_PRICE = 6
name = models.CharField(_("name"), max_length=64)
description = models.TextField(_("description"), default="")
product_type = models.ForeignKey(
@ -426,6 +428,13 @@ class Product(models.Model):
def profit(self):
return self.selling_price - self.purchase_price
def get_actual_price(self, counter: Counter, customer: Customer):
"""Return the price of the article taking into account if the customer has a special price
or not in the counter it's being purchased on"""
if counter.customer_is_barman(customer):
return self.special_selling_price
return self.selling_price
class CounterQuerySet(models.QuerySet):
def annotate_has_barman(self, user: User) -> Self: