mirror of
https://github.com/almet/copanier.git
synced 2025-04-28 11:32:38 +02:00
Display shipping prices in the order summary
This commit is contained in:
parent
0ba6dfcc45
commit
b26f07ab5a
2 changed files with 17 additions and 9 deletions
|
@ -293,12 +293,15 @@ class Order(Base):
|
|||
p.quantity * _get_price(ref) for ref, p in self.products.items()
|
||||
)
|
||||
|
||||
shipping = self.compute_shipping(delivery, producers, email) if include_shipping else 0
|
||||
|
||||
return round(total_products + shipping, 2)
|
||||
|
||||
def compute_shipping(self, delivery, producers, email):
|
||||
total_shipping = 0
|
||||
if include_shipping:
|
||||
for producer in producers:
|
||||
total_shipping = total_shipping + delivery.shipping_for(email, producer)
|
||||
|
||||
return round(total_products + total_shipping, 2)
|
||||
return total_shipping
|
||||
|
||||
@property
|
||||
def has_adjustments(self):
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
<table class="order">
|
||||
<tr><th class="product">Produit</th>{% if display_prices %}<th class="price">Prix unitaire</th>{% endif %}<th class="amount">Quantité</th></tr>
|
||||
<tr><th class="product">Produit</th>{% if display_prices %}<th class="price">Prix unitaire (€)</th>{% endif %}<th class="amount">Quantité</th>{% if display_prices %}<th class="sum">Somme (€)</th>{% endif %}</tr>
|
||||
{% for product in delivery.products %}
|
||||
{% if order[product].quantity %}
|
||||
<tr {% if product.rupture %}class="rupture"{% endif %}>
|
||||
<th class="product" style="text-align: left;">{{ product }}{% if product.rupture %} (rupture){% endif %}</th>
|
||||
{% if display_prices %}<td>{{ product.price | round(2) }} €</td>{% endif %}<td>{{ order[product].quantity }} x {{ product.unit }}</td>
|
||||
{% if display_prices %}
|
||||
<td>{{ product.price | round(2) }} €</td>
|
||||
{% endif %}
|
||||
<td>{{ order[product].quantity }} x {{ product.unit }}</td>
|
||||
{% if display_prices %}
|
||||
<td>{{ order.total([product], delivery, group_id, False) }}</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% if product.rupture %}</del>{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
<p>Total: {{ order.total(delivery.products, delivery, group_id) if order else 0 }} €</p>
|
||||
<p>Total: {{ order.total(delivery.products, delivery, group_id) if order else 0 }} € (dont {{ order.compute_shipping(delivery, delivery.producers, group_id) | round(2) }} de port)</p>
|
||||
|
|
Loading…
Reference in a new issue