2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-05 19:41:41 +00:00

Include stock item purchase price in pricing cache (#4292)

* Add setting to control pricing calculation from stock items

* Bug fix for displaying a "null" setting

* Add new fields to PartPricing model

* Add code for calculation of min/max stock item costs

* Update pricing display to use stock item pricing

* Add unit testing for new pricing features

* Automatically update pricing when stock item is created or edited

* Increment API version

* Improvements for price rendering

* Update based on feedback:

- Roll stock item pricing into purchase pricing
- Simplify models
- Update unit tests
This commit is contained in:
Oliver
2023-02-02 21:23:16 +11:00
committed by GitHub
parent df4209801a
commit 9a289948e5
10 changed files with 126 additions and 42 deletions

View File

@@ -15,8 +15,11 @@
{% include "InvenTree/settings/setting.html" with key="PART_BOM_USE_INTERNAL_PRICE" %}
{% include "InvenTree/settings/setting.html" with key="PRICING_DECIMAL_PLACES" %}
{% include "InvenTree/settings/setting.html" with key="PRICING_UPDATE_DAYS" icon='fa-calendar-alt' %}
<tr><td colspan='5'></td></tr>
{% include "InvenTree/settings/setting.html" with key="PRICING_USE_SUPPLIER_PRICING" icon='fa-check-circle' %}
{% include "InvenTree/settings/setting.html" with key="PRICING_PURCHASE_HISTORY_OVERRIDES_SUPPLIER" icon='fa-shopping-cart' %}
{% include "InvenTree/settings/setting.html" with key="PRICING_USE_STOCK_PRICING" icon='fa-boxes' %}
{% include "InvenTree/settings/setting.html" with key="PRICING_STOCK_ITEM_AGE_DAYS" icon='fa-calendar-alt' %}
{% include "InvenTree/settings/setting.html" with key="PRICING_USE_VARIANT_PRICING" icon='fa-check-circle' %}
{% include "InvenTree/settings/setting.html" with key="PRICING_ACTIVE_VARIANTS" %}
@@ -57,6 +60,7 @@
<td></td>
<th>{% trans "Base Currency" %}</th>
<th>{{ base_currency }}</th>
<th colspan='2'></th>
</tr>
<tr>
<td></td>
@@ -70,7 +74,6 @@
<td></td>
<td>{{ rate.currency }}</td>
<td>{{ rate.value }}</td>
<td></td>
</tr>
{% endfor %}
</tbody>

View File

@@ -27,14 +27,14 @@
{% else %}
<div id='setting-{{ setting.pk }}'>
<span id='setting-value-{{ setting.pk }}-{{ setting.typ }}' fieldname='{{ setting.key.upper }}'>
{% if setting.value %}
{% if setting.value == '' %}
<em style='color: #855;'>{% trans "No value set" %}</em>
{% else %}
{% if setting.is_choice %}
<strong>{{ setting.as_choice }}</strong>
{% else %}
<strong>{{ setting.value }}</strong>
{% endif %}
{% else %}
<em style='color: #855;'>{% trans "No value set" %}</em>
{% endif %}
</span>
{{ setting.units }}