sale price in pricing table

This commit is contained in:
Matthias 2021-05-05 23:49:04 +02:00
parent 1b7ade9405
commit 030865f8dd
2 changed files with 20 additions and 0 deletions

View File

@ -79,6 +79,20 @@
</table>
{% endif %}
{% if total_part_price %}
<h4>{% trans 'Sale Price' %}</h4>
<table class='table table-striped table-condensed'>
<tr>
<td><b>{% trans 'Unit Cost' %}</b></td>
<td colspan='2'>{% include "price.html" with price=unit_part_price %}</td>
</tr>
<tr>
<td><b>{% trans 'Total Cost' %}</b></td>
<td colspan='2'>{% include "price.html" with price=total_part_price %}</td>
</tr>
</table>
{% endif %}
{% if min_unit_buy_price or min_unit_bom_price %}
{% else %}
<div class='alert alert-danger alert-block'>

View File

@ -2055,6 +2055,12 @@ class PartPricing(AjaxView):
ctx['max_total_bom_price'] = max_bom_price
ctx['max_unit_bom_price'] = max_unit_bom_price
# part pricing information
part_price = part.get_price(quantity)
if part_price is not None:
ctx['total_part_price'] = round(part_price, 3)
ctx['unit_part_price'] = round(part_price / quantity, 3)
return ctx
def get(self, request, *args, **kwargs):