Merge pull request #1691 from matmair/purchase-price-zero

Purchase price zero
This commit is contained in:
Oliver 2021-06-21 08:26:42 +10:00 committed by GitHub
commit b7a5a7f524
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -137,7 +137,7 @@
<hr>
<h4>{% trans 'Stock Pricing' %}<i class="fas fa-info-circle" title="Shows the purchase prices of stock for this part.
The part single price is the current purchase price for that supplier part."></i></h4>
{% if price_history|length > 1 %}
{% if price_history|length > 0 %}
<div style="max-width: 99%; min-height: 300px">
<canvas id="StockPriceChart"></canvas>
</div>

View File

@ -814,7 +814,7 @@ class PartPricingView(PartDetail):
part = self.get_part()
# Stock history
if part.total_stock > 1:
ret = []
price_history = []
stock = part.stock_entries(include_variants=False, in_stock=True) # .order_by('purchase_order__date')
stock = stock.prefetch_related('purchase_order', 'supplier_part')
@ -841,9 +841,9 @@ class PartPricingView(PartDetail):
line['date'] = stock_item.purchase_order.issue_date.strftime('%d.%m.%Y')
else:
line['date'] = stock_item.tracking_info.first().date.strftime('%d.%m.%Y')
ret.append(line)
price_history.append(line)
ctx['price_history'] = ret
ctx['price_history'] = price_history
# BOM Information for Pie-Chart
if part.has_bom:

View File

@ -325,7 +325,7 @@
<td><a href="{% url 'po-detail' item.purchase_order.id %}">{{ item.purchase_order }}</a></td>
</tr>
{% endif %}
{% if item.purchase_price %}
{% if item.purchase_price != None %}
<tr>
<td><span class='fas fa-dollar-sign'></span></td>
<td>{% trans "Purchase Price" %}</td>