Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions shopinvader_schema_sale/schemas/amount.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class SaleAmount(StrictExtendableBaseModel):
total: float = Field(description="Total amount")
discount_total: float
total_without_discount: float
untaxed_without_discount: float

@classmethod
def from_sale_order(cls, sale_order):
Expand All @@ -22,6 +23,9 @@ def from_sale_order(cls, sale_order):
total_without_discount=float_round(
sale_order.price_total_no_discount, precision
),
untaxed_without_discount=float_round(
sale_order.price_subtotal_no_discount, precision
),
tax=float_round(sale_order.amount_tax, precision),
untaxed=float_round(sale_order.amount_untaxed, precision),
total=float_round(sale_order.amount_total, precision),
Expand All @@ -35,6 +39,9 @@ def from_sale_order_line(cls, order_line):
total_without_discount=float_round(
order_line.price_total_no_discount, precision
),
untaxed_without_discount=float_round(
order_line.price_subtotal_no_discount, precision
),
tax=float_round(order_line.price_tax, precision),
untaxed=float_round(order_line.price_subtotal, precision),
total=float_round(order_line.price_total, precision),
Expand Down
Loading