settings for internal prices added

This commit is contained in:
Matthias 2021-06-07 04:58:37 +02:00
parent 62638f76ed
commit 37c0025399
4 changed files with 27 additions and 2 deletions

View File

@ -205,6 +205,20 @@ class InvenTreeSetting(models.Model):
'validator': bool, 'validator': bool,
}, },
'PART_INTERNAL_PRICE': {
'name': _('Internal Prices'),
'description': _('Set internal prices for parts'),
'default': False,
'validator': bool
},
'PART_BOM_USE_INTERNAL_PRICE': {
'name': _('Internal Prices in BOM-Price'),
'description': _('Use the internal price (if set) for BOM-price calculations'),
'default': False,
'validator': bool
},
'REPORT_DEBUG_MODE': { 'REPORT_DEBUG_MODE': {
'name': _('Debug Mode'), 'name': _('Debug Mode'),
'description': _('Generate reports in debug mode (HTML output)'), 'description': _('Generate reports in debug mode (HTML output)'),

View File

@ -1,6 +1,7 @@
{% extends "part/part_base.html" %} {% extends "part/part_base.html" %}
{% load static %} {% load static %}
{% load i18n %} {% load i18n %}
{% load inventree_extras %}
{% block menubar %} {% block menubar %}
{% include 'part/navbar.html' with tab='internal-prices' %} {% include 'part/navbar.html' with tab='internal-prices' %}
@ -11,7 +12,8 @@
{% endblock %} {% endblock %}
{% block details %} {% block details %}
{% settings_value "PART_INTERNAL_PRICE" as show_internal_price %}
{% if show_internal_price %}
<div id='internal-price-break-toolbar' class='btn-group'> <div id='internal-price-break-toolbar' class='btn-group'>
<button class='btn btn-primary' id='new-internal-price-break' type='button'> <button class='btn btn-primary' id='new-internal-price-break' type='button'>
<span class='fas fa-plus-circle'></span> {% trans "Add Internal Price Break" %} <span class='fas fa-plus-circle'></span> {% trans "Add Internal Price Break" %}
@ -21,11 +23,14 @@
<table class='table table-striped table-condensed' id='internal-price-break-table' data-toolbar='#internal-price-break-toolbar'> <table class='table table-striped table-condensed' id='internal-price-break-table' data-toolbar='#internal-price-break-toolbar'>
</table> </table>
{% endif %}
{% endblock %} {% endblock %}
{% block js_ready %} {% block js_ready %}
{{ block.super }} {{ block.super }}
{% settings_value "PART_INTERNAL_PRICE" as show_internal_price %}
{% if show_internal_price %}
function reloadPriceBreaks() { function reloadPriceBreaks() {
$("#internal-price-break-table").bootstrapTable("refresh"); $("#internal-price-break-table").bootstrapTable("refresh");
} }
@ -105,4 +110,5 @@ $('#internal-price-break-table').inventreeTable({
] ]
}) })
{% endif %}
{% endblock %} {% endblock %}

View File

@ -2,6 +2,8 @@
{% load static %} {% load static %}
{% load inventree_extras %} {% load inventree_extras %}
{% settings_value "PART_INTERNAL_PRICE" as show_internal_price %}
<ul class='list-group'> <ul class='list-group'>
<li class='list-group-item'> <li class='list-group-item'>
<a href='#' id='part-menu-toggle'> <a href='#' id='part-menu-toggle'>
@ -94,7 +96,7 @@
</a> </a>
</li> </li>
{% endif %} {% endif %}
{% if part.salable and roles.sales_order.view %} {% if show_internal_price %}
<li class='list-group-item {% if tab == "internal-prices" %}active{% endif %}' title='{% trans "Internal Price Information" %}'> <li class='list-group-item {% if tab == "internal-prices" %}active{% endif %}' title='{% trans "Internal Price Information" %}'>
<a href='{% url "part-internal-prices" part.id %}'> <a href='{% url "part-internal-prices" part.id %}'>
<span class='menu-tab-icon fas fa-dollar-sign' style='width: 20px;'></span> <span class='menu-tab-icon fas fa-dollar-sign' style='width: 20px;'></span>

View File

@ -34,6 +34,9 @@
{% include "InvenTree/settings/setting.html" with key="PART_COPY_PARAMETERS" %} {% include "InvenTree/settings/setting.html" with key="PART_COPY_PARAMETERS" %}
{% include "InvenTree/settings/setting.html" with key="PART_COPY_TESTS" %} {% include "InvenTree/settings/setting.html" with key="PART_COPY_TESTS" %}
{% include "InvenTree/settings/setting.html" with key="PART_CATEGORY_PARAMETERS" %} {% include "InvenTree/settings/setting.html" with key="PART_CATEGORY_PARAMETERS" %}
<tr><td colspan='5'></td></tr>
{% include "InvenTree/settings/setting.html" with key="PART_INTERNAL_PRICE" %}
{% include "InvenTree/settings/setting.html" with key="PART_BOM_USE_INTERNAL_PRICE" %}
</tbody> </tbody>
</table> </table>