Fix: Schema would show the full price for happy hour products
This commit is contained in:
parent
05302c4291
commit
f1ef578eae
@ -55,11 +55,9 @@ class Inventory(BaseModel):
|
||||
|
||||
@model_validator(mode="after")
|
||||
def calculate_amount(self) -> "Inventory":
|
||||
price = 0 if self.is_happy_hour else self.price
|
||||
self.amount = round(
|
||||
Decimal(
|
||||
(self.price or Decimal(0)) * self.quantity * (1 - self.discount) * (1 + (self.tax_rate or Decimal(0)))
|
||||
),
|
||||
2,
|
||||
Decimal(price * self.quantity * (1 - self.discount) * (1 + (self.tax_rate or Decimal(0)))), 2
|
||||
)
|
||||
return self
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user