Merge branch 'master' of https://github.com/inventree/InvenTree into price-history

This commit is contained in:
Matthias 2021-05-13 22:58:01 +02:00
commit be92efe7b9
20 changed files with 223 additions and 65 deletions

View File

@ -1,14 +1,31 @@
function attachClipboard(selector) {
new ClipboardJS(selector, {
text: function(trigger) {
var content = trigger.parentElement.parentElement.textContent;
return content.trim();
function attachClipboard(selector, containerselector, textElement) {
// set container
if (containerselector){
containerselector = document.getElementById(containerselector);
} else {
containerselector = document.body;
}
// set text-function
if (textElement){
text = function() {
return document.getElementById(textElement).textContent;
}
} else {
text = function() {
var content = trigger.parentElement.parentElement.textContent;return content.trim();
}
}
// create Clipboard
var cis = new ClipboardJS(selector, {
text: text,
container: containerselector
});
console.log(cis);
}
function inventreeDocReady() {
/* Run this function when the HTML document is loaded.
* This will be called for every page that extends "base.html"
@ -62,6 +79,8 @@ function inventreeDocReady() {
// Initialize clipboard-buttons
attachClipboard('.clip-btn');
attachClipboard('.clip-btn', 'modal-about'); // modals
attachClipboard('.clip-btn-version', 'modal-about', 'about-copy-text'); // version-text
}

View File

@ -19,12 +19,12 @@
<tr>
<td><span class='fas fa-info'></span></td>
<td>{% trans "Description" %}</td>
<td>{{ build.title }}</td>
<td>{{ build.title }}{% include "clip.html"%}</td>
</tr>
<tr>
<td><span class='fas fa-shapes'></span></td>
<td>{% trans "Part" %}</td>
<td><a href="{% url 'part-build' build.part.id %}">{{ build.part.full_name }}</a></td>
<td><a href="{% url 'part-build' build.part.id %}">{{ build.part.full_name }}</a>{% include "clip.html"%}</td>
</tr>
<tr>
<td></td>
@ -35,7 +35,7 @@
<td>{% trans "Stock Source" %}</td>
<td>
{% if build.take_from %}
<a href="{% url 'stock-location-detail' build.take_from.id %}">{{ build.take_from }}</a>
<a href="{% url 'stock-location-detail' build.take_from.id %}">{{ build.take_from }}</a>{% include "clip.html"%}
{% else %}
<i>{% trans "Stock can be taken from any available location." %}</i>
{% endif %}
@ -48,7 +48,7 @@
{% if build.destination %}
<a href="{% url 'stock-location-detail' build.destination.id %}">
{{ build.destination }}
</a>
</a>{% include "clip.html"%}
{% else %}
<i>{% trans "Destination location not specified" %}</i>
{% endif %}
@ -68,28 +68,28 @@
<tr>
<td><span class='fas fa-layer-group'></span></td>
<td>{% trans "Batch" %}</td>
<td>{{ build.batch }}</td>
<td>{{ build.batch }}{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if build.parent %}
<tr>
<td><span class='fas fa-sitemap'></span></td>
<td>{% trans "Parent Build" %}</td>
<td><a href="{% url 'build-detail' build.parent.id %}">{{ build.parent }}</a></td>
<td><a href="{% url 'build-detail' build.parent.id %}">{{ build.parent }}</a>{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if build.sales_order %}
<tr>
<td><span class='fas fa-dolly'></span></td>
<td>{% trans "Sales Order" %}</td>
<td><a href="{% url 'so-detail' build.sales_order.id %}">{{ build.sales_order }}</a></td>
<td><a href="{% url 'so-detail' build.sales_order.id %}">{{ build.sales_order }}</a>{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if build.link %}
<tr>
<td><span class='fas fa-link'></span></td>
<td>{% trans "External Link" %}</td>
<td><a href="{{ build.link }}">{{ build.link }}</a></td>
<td><a href="{{ build.link }}">{{ build.link }}</a>{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if build.issued_by %}

View File

@ -68,35 +68,35 @@
<tr>
<td><span class='fas fa-globe'></span></td>
<td>{% trans "Website" %}</td>
<td><a href="{{ company.website }}">{{ company.website }}</a></td>
<td><a href="{{ company.website }}">{{ company.website }}</a>{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if company.address %}
<tr>
<td><span class='fas fa-map-marked-alt'></span></td>
<td>{% trans "Address" %}</td>
<td>{{ company.address }}</td>
<td>{{ company.address }}{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if company.phone %}
<tr>
<td><span class='fas fa-phone'></span></td>
<td>{% trans "Phone" %}</td>
<td>{{ company.phone }}</td>
<td>{% include "tel.html" with tel=company.phone %}</td>
</tr>
{% endif %}
{% if company.email %}
<tr>
<td><span class='fas fa-at'></span></td>
<td>{% trans "Email" %}</td>
<td>{{ company.email }}</td>
<td>{% include "mail.html" with mail=company.email %}</td>
</tr>
{% endif %}
{% if company.contact %}
<tr>
<td><span class='fas fa-user'></span></td>
<td>{% trans "Contact" %}</td>
<td>{{ company.contact }}</td>
<td>{{ company.contact }}{% include "clip.html"%}</td>
</tr>
{% endif %}
</table>

View File

@ -19,20 +19,20 @@
<tr>
<td><span class='fas fa-font'></span></td>
<td>{% trans "Company Name" %}</td>
<td>{{ company.name }}</td>
<td>{{ company.name }}{% include "clip.html"%}</td>
</tr>
{% if company.description %}
<tr>
<td><span class='fas fa-info'></span></td>
<td>{% trans "Description" %}</td>
<td>{{ company.description }}</td>
<td>{{ company.description }}{% include "clip.html"%}</td>
</tr>
{% endif %}
<tr>
<td><span class='fas fa-globe'></span></td>
<td>{% trans "Website" %}</td>
<td>
{% if company.website %}<a href='{{ company.website }}'>{{ company.website }}</a>
{% if company.website %}<a href='{{ company.website }}'>{{ company.website }}</a>{% include "clip.html"%}
{% else %}<i>{% trans "No website specified" %}</i>
{% endif %}
</td>

View File

@ -62,7 +62,7 @@ src="{% static 'img/blank_image.png' %}"
<td>{% trans "Internal Part" %}</td>
<td>
{% if part.part %}
<a href="{% url 'part-manufacturers' part.part.id %}">{{ part.part.full_name }}</a>
<a href="{% url 'part-manufacturers' part.part.id %}">{{ part.part.full_name }}</a>{% include "clip.html"%}
{% endif %}
</td>
</tr>
@ -70,24 +70,24 @@ src="{% static 'img/blank_image.png' %}"
<tr>
<td></td>
<td>{% trans "Description" %}</td>
<td>{{ part.description }}</td>
<td>{{ part.description }}{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if part.link %}
<tr>
<td><span class='fas fa-link'></span></td>
<td>{% trans "External Link" %}</td>
<td><a href="{{ part.link }}">{{ part.link }}</a></td>
<td><a href="{{ part.link }}">{{ part.link }}</a>{% include "clip.html"%}</td>
</tr>
{% endif %}
<tr>
<td><span class='fas fa-industry'></span></td>
<td>{% trans "Manufacturer" %}</td>
<td><a href="{% url 'company-detail-manufacturer-parts' part.manufacturer.id %}">{{ part.manufacturer.name }}</a></td></tr>
<td><a href="{% url 'company-detail-manufacturer-parts' part.manufacturer.id %}">{{ part.manufacturer.name }}</a>{% include "clip.html"%}</td></tr>
<tr>
<td><span class='fas fa-hashtag'></span></td>
<td>{% trans "MPN" %}</td>
<td>{{ part.MPN }}</td>
<td>{{ part.MPN }}{% include "clip.html"%}</td>
</tr>
</table>
{% endblock %}

View File

@ -61,7 +61,7 @@ src="{% static 'img/blank_image.png' %}"
<td>{% trans "Internal Part" %}</td>
<td>
{% if part.part %}
<a href="{% url 'part-suppliers' part.part.id %}">{{ part.part.full_name }}</a>
<a href="{% url 'part-suppliers' part.part.id %}">{{ part.part.full_name }}</a>{% include "clip.html"%}
{% endif %}
</td>
</tr>
@ -69,51 +69,52 @@ src="{% static 'img/blank_image.png' %}"
<tr>
<td></td>
<td>{% trans "Description" %}</td>
<td>{{ part.description }}</td>
<td>{{ part.description }}{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if part.link %}
<tr>
<td><span class='fas fa-link'></span></td>
<td>{% trans "External Link" %}</td>
<td><a href="{{ part.link }}">{{ part.link }}</a></td>
<td><a href="{{ part.link }}">{{ part.link }}</a>{% include "clip.html"%}</td>
</tr>
{% endif %}
<tr>
<td><span class='fas fa-building'></span></td>
<td>{% trans "Supplier" %}</td>
<td><a href="{% url 'company-detail-supplier-parts' part.supplier.id %}">{{ part.supplier.name }}</a></td></tr>
<td><a href="{% url 'company-detail-supplier-parts' part.supplier.id %}">{{ part.supplier.name }}</a>{% include "clip.html"%}</td></tr>
<tr>
<td><span class='fas fa-hashtag'></span></td>
<td>{% trans "SKU" %}</td>
<td>{{ part.SKU }}</tr>
<td>{{ part.SKU }}{% include "clip.html"%}</tr>
</tr>
{% if part.manufacturer_part.manufacturer %}
<tr>
<td><span class='fas fa-industry'></span></td>
<td>{% trans "Manufacturer" %}</td>
<td><a href="{% url 'company-detail-manufacturer-parts' part.manufacturer_part.manufacturer.id %}">{{ part.manufacturer_part.manufacturer.name }}</a></td>
<td><a href="{% url 'company-detail-manufacturer-parts' part.manufacturer_part.manufacturer.id %}">
{{ part.manufacturer_part.manufacturer.name }}</a>{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if part.manufacturer_part.MPN %}
<tr>
<td><span class='fas fa-hashtag'></span></td>
<td>{% trans "MPN" %}</td>
<td><a href="{% url 'manufacturer-part-detail' part.manufacturer_part.id %}">{{ part.manufacturer_part.MPN }}</a></td>
<td><a href="{% url 'manufacturer-part-detail' part.manufacturer_part.id %}">{{ part.manufacturer_part.MPN }}</a>{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if part.packaging %}
<tr>
<td><span class='fas fa-cube'></span></td>
<td>{% trans "Packaging" %}</td>
<td>{{ part.packaging }}</td>
<td>{{ part.packaging }}{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if part.note %}
<tr>
<td><span class='fas fa-sticky-note'></span></td>
<td>{% trans "Note" %}</td>
<td>{{ part.note }}</td>
<td>{{ part.note }}{% include "clip.html"%}</td>
</tr>
{% endif %}
</table>

View File

@ -28,14 +28,14 @@
<tr><td>{% trans "External Link" %}</td><td><a href="{{ part.link }}">{{ part.link }}</a></td></tr>
{% endif %}
{% if part.description %}
<tr><td>{% trans "Description" %}</td><td>{{ part.description }}</td></tr>
<tr><td>{% trans "Description" %}</td><td>{{ part.description }}{% include "clip.html"%}</td></tr>
{% endif %}
{% if part.manufacturer %}
<tr><td>{% trans "Manufacturer" %}</td><td>{{ part.manufacturer }}</td></tr>
<tr><td>{% trans "MPN" %}</td><td>{{ part.MPN }}</td></tr>
<tr><td>{% trans "Manufacturer" %}</td><td>{{ part.manufacturer }}{% include "clip.html"%}</td></tr>
<tr><td>{% trans "MPN" %}</td><td>{{ part.MPN }}{% include "clip.html"%}</td></tr>
{% endif %}
{% if part.note %}
<tr><td>{% trans "Note" %}</td><td>{{ part.note }}</td></tr>
<tr><td>{% trans "Note" %}</td><td>{{ part.note }}{% include "clip.html"%}</td></tr>
{% endif %}
</table>

View File

@ -63,16 +63,23 @@ class LabelPrintMixin:
# In debug mode, generate single HTML output, rather than PDF
debug_mode = common.models.InvenTreeSetting.get_setting('REPORT_DEBUG_MODE')
label_name = "label.pdf"
# Merge one or more PDF files into a single download
for item in items_to_print:
label = self.get_object()
label.object_to_print = item
label_name = label.generate_filename(request)
if debug_mode:
outputs.append(label.render_as_string(request))
else:
outputs.append(label.render(request))
if not label_name.endswith(".pdf"):
label_name += ".pdf"
if debug_mode:
"""
Contatenate all rendered templates into a single HTML string,
@ -103,7 +110,7 @@ class LabelPrintMixin:
return InvenTree.helpers.DownloadFile(
pdf,
'inventree_label.pdf',
label_name,
content_type='application/pdf'
)

View File

@ -0,0 +1,23 @@
# Generated by Django 3.2 on 2021-05-13 03:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('label', '0006_auto_20210222_1535'),
]
operations = [
migrations.AddField(
model_name='stockitemlabel',
name='filename_pattern',
field=models.CharField(default='label.pdf', help_text='Pattern for generating label filenames', max_length=100, verbose_name='Filename Pattern'),
),
migrations.AddField(
model_name='stocklocationlabel',
name='filename_pattern',
field=models.CharField(default='label.pdf', help_text='Pattern for generating label filenames', max_length=100, verbose_name='Filename Pattern'),
),
]

View File

@ -15,6 +15,7 @@ from django.db import models
from django.core.validators import FileExtensionValidator, MinValueValidator
from django.core.exceptions import ValidationError, FieldError
from django.template import Template, Context
from django.template.loader import render_to_string
from django.utils.translation import gettext_lazy as _
@ -138,6 +139,13 @@ class LabelTemplate(models.Model):
validators=[MinValueValidator(2)]
)
filename_pattern = models.CharField(
default="label.pdf",
verbose_name=_('Filename Pattern'),
help_text=_('Pattern for generating label filenames'),
max_length=100,
)
@property
def template_name(self):
"""
@ -162,6 +170,19 @@ class LabelTemplate(models.Model):
return {}
def generate_filename(self, request, **kwargs):
"""
Generate a filename for this label
"""
template_string = Template(self.filename_pattern)
ctx = self.context(request)
context = Context(ctx)
return template_string.render(context)
def context(self, request):
"""
Provides context data to the template.
@ -201,6 +222,7 @@ class LabelTemplate(models.Model):
self.template_name,
base_url=request.build_absolute_uri("/"),
presentational_hints=True,
filename=self.generate_filename(request),
**kwargs
)

View File

@ -33,7 +33,7 @@ src="{% static 'img/blank_image.png' %}"
{% endif %}
</h3>
<hr>
<p>{{ order.description }}</p>
<p>{{ order.description }}{% include "clip.html"%}</p>
<div class='btn-row'>
<div class='btn-group action-buttons' role='group'>
<button type='button' class='btn btn-default' id='print-order-report' title='{% trans "Print" %}'>
@ -75,7 +75,7 @@ src="{% static 'img/blank_image.png' %}"
<tr>
<td><span class='fas fa-hashtag'></span></td>
<td>{% trans "Order Reference" %}</td>
<td>{{ order.reference }}</td>
<td>{{ order.reference }}{% include "clip.html"%}</td>
</tr>
<tr>
<td><span class='fas fa-info'></span></td>
@ -90,20 +90,20 @@ src="{% static 'img/blank_image.png' %}"
<tr>
<td><span class='fas fa-building'></span></td>
<td>{% trans "Supplier" %}</td>
<td><a href="{% url 'company-detail' order.supplier.id %}">{{ order.supplier.name }}</a></td>
<td><a href="{% url 'company-detail' order.supplier.id %}">{{ order.supplier.name }}</a>{% include "clip.html"%}</td>
</tr>
{% if order.supplier_reference %}
<tr>
<td><span class='fas fa-hashtag'></span></td>
<td>{% trans "Supplier Reference" %}</td>
<td>{{ order.supplier_reference }}</td>
<td>{{ order.supplier_reference }}{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if order.link %}
<tr>
<td><span class='fas fa-link'></span></td>
<td>External Link</td>
<td><a href="{{ order.link }}">{{ order.link }}</a></td>
<td><a href="{{ order.link }}">{{ order.link }}</a>{% include "clip.html"%}</td>
</tr>
{% endif %}
<tr>

View File

@ -42,7 +42,7 @@ src="{% static 'img/blank_image.png' %}"
{% endif %}
</h3>
<hr>
<p>{{ order.description }}</p>
<p>{{ order.description }}{% include "clip.html"%}</p>
<div class='btn-row'>
<div class='btn-group action-buttons'>
<button type='button' class='btn btn-default' id='print-order-report' title='{% trans "Print" %}'>
@ -75,7 +75,7 @@ src="{% static 'img/blank_image.png' %}"
<tr>
<td><span class='fas fa-hashtag'></span></td>
<td>{% trans "Order Reference" %}</td>
<td>{{ order.reference }}</td>
<td>{{ order.reference }}{% include "clip.html"%}</td>
</tr>
<tr>
<td><span class='fas fa-info'></span></td>
@ -90,20 +90,20 @@ src="{% static 'img/blank_image.png' %}"
<tr>
<td><span class='fas fa-building'></span></td>
<td>{% trans "Customer" %}</td>
<td><a href="{% url 'company-detail' order.customer.id %}">{{ order.customer.name }}</a></td>
<td><a href="{% url 'company-detail' order.customer.id %}">{{ order.customer.name }}</a>{% include "clip.html"%}</td>
</tr>
{% if order.customer_reference %}
<tr>
<td><span class='fas fa-hashtag'></span></td>
<td>{% trans "Customer Reference" %}</td>
<td>{{ order.customer_reference }}</td>
<td>{{ order.customer_reference }}{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if order.link %}
<tr>
<td><span class='fas fa-link'></span></td>
<td>External Link</td>
<td><a href="{{ order.link }}">{{ order.link }}</a></td>
<td><a href="{{ order.link }}">{{ order.link }}</a>{% include "clip.html"%}</td>
</tr>
{% endif %}
<tr>

View File

@ -58,14 +58,14 @@
<tr>
<td></td>
<td><strong>{% trans "Variant Of" %}</strong></td>
<td><a href="{% url 'part-detail' part.variant_of.id %}">{{ part.variant_of.full_name }}</a></td>
<td><a href="{% url 'part-detail' part.variant_of.id %}">{{ part.variant_of.full_name }}</a>{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if part.keywords %}
<tr>
<td><span class='fas fa-key'></span></td>
<td><strong>{% trans "Keywords" %}</strong></td>
<td>{{ part.keywords }}</td>
<td>{{ part.keywords }}{% include "clip.html"%}</td>
</tr>
{% endif %}
<tr>
@ -73,7 +73,7 @@
<td><strong>{% trans "Category" %}</strong></td>
<td>
{% if part.category %}
<a href="{% url 'category-detail' part.category.id %}">{{ part.category.pathstring }}</a>
<a href="{% url 'category-detail' part.category.id %}">{{ part.category.pathstring }}</a>{% include "clip.html"%}
{% endif %}
</td>
</tr>
@ -81,14 +81,14 @@
<tr>
<td><span class='fas fa-link'></span></td>
<td><strong>{% trans "External Link" %}</strong></td>
<td><a href="{{ part.link }}">{{ part.link }}</a></td>
<td><a href="{{ part.link }}">{{ part.link }}</a>{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if part.default_location %}
<tr>
<td><span class='fas fa-map-marker-alt'></span></td>
<td><strong>{% trans "Default Location" %}</strong></td>
<td><a href="{% url 'stock-location-detail' part.default_location.id %}">{{ part.default_location.pathstring }}</a></td>
<td><a href="{% url 'stock-location-detail' part.default_location.id %}">{{ part.default_location.pathstring }}</a>{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if part.default_supplier %}
@ -96,15 +96,15 @@
<td></td>
<td><strong>{% trans "Default Supplier" %}</strong></td>
<td><a href="{% url 'supplier-part-detail' part.default_supplier.id %}">
{{ part.default_supplier.supplier.name }} | {{ part.default_supplier.SKU }}{% include "clip.html"%}
</a></td>
{{ part.default_supplier.supplier.name }} | {{ part.default_supplier.SKU }}
</a>{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if part.units %}
<tr>
<td></td>
<td><strong>{% trans "Units" %}</strong></td>
<td>{{ part.units }}</td>
<td>{{ part.units }}{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if part.minimum_stock > 0 %}

View File

@ -208,16 +208,24 @@ class ReportPrintMixin:
# In debug mode, generate single HTML output, rather than PDF
debug_mode = common.models.InvenTreeSetting.get_setting('REPORT_DEBUG_MODE')
# Start with a default report name
report_name = "report.pdf"
# Merge one or more PDF files into a single download
for item in items_to_print:
report = self.get_object()
report.object_to_print = item
report_name = report.generate_filename(request)
if debug_mode:
outputs.append(report.render_as_string(request))
else:
outputs.append(report.render(request))
if not report_name.endswith('.pdf'):
report_name += '.pdf'
if debug_mode:
"""
Contatenate all rendered templates into a single HTML string,
@ -248,7 +256,7 @@ class ReportPrintMixin:
return InvenTree.helpers.DownloadFile(
pdf,
'inventree_report.pdf',
report_name,
content_type='application/pdf'
)

View File

@ -0,0 +1,38 @@
# Generated by Django 3.2 on 2021-05-13 03:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('report', '0015_auto_20210403_1837'),
]
operations = [
migrations.AddField(
model_name='billofmaterialsreport',
name='filename_pattern',
field=models.CharField(default='report.pdf', help_text='Pattern for generating report filenames', max_length=100, verbose_name='Filename Pattern'),
),
migrations.AddField(
model_name='buildreport',
name='filename_pattern',
field=models.CharField(default='report.pdf', help_text='Pattern for generating report filenames', max_length=100, verbose_name='Filename Pattern'),
),
migrations.AddField(
model_name='purchaseorderreport',
name='filename_pattern',
field=models.CharField(default='report.pdf', help_text='Pattern for generating report filenames', max_length=100, verbose_name='Filename Pattern'),
),
migrations.AddField(
model_name='salesorderreport',
name='filename_pattern',
field=models.CharField(default='report.pdf', help_text='Pattern for generating report filenames', max_length=100, verbose_name='Filename Pattern'),
),
migrations.AddField(
model_name='testreport',
name='filename_pattern',
field=models.CharField(default='report.pdf', help_text='Pattern for generating report filenames', max_length=100, verbose_name='Filename Pattern'),
),
]

View File

@ -16,6 +16,7 @@ from django.conf import settings
from django.core.exceptions import ValidationError, FieldError
from django.template.loader import render_to_string
from django.template import Template, Context
from django.core.files.storage import FileSystemStorage
from django.core.validators import FileExtensionValidator
@ -224,6 +225,7 @@ class ReportTemplateBase(ReportBase):
All context to be passed to the renderer.
"""
# Generate custom context data based on the particular report subclass
context = self.get_context_data(request)
context['base_url'] = common.models.InvenTreeSetting.get_setting('INVENTREE_BASE_URL')
@ -238,9 +240,22 @@ class ReportTemplateBase(ReportBase):
return context
def generate_filename(self, request, **kwargs):
"""
Generate a filename for this report
"""
template_string = Template(self.filename_pattern)
ctx = self.context(request)
context = Context(ctx)
return template_string.render(context)
def render_as_string(self, request, **kwargs):
"""
Render the report to a HTML stiring.
Render the report to a HTML string.
Useful for debug mode (viewing generated code)
"""
@ -263,12 +278,20 @@ class ReportTemplateBase(ReportBase):
self.template_name,
base_url=request.build_absolute_uri("/"),
presentational_hints=True,
filename=self.generate_filename(request),
**kwargs)
return wp.render_to_response(
self.context(request),
**kwargs)
filename_pattern = models.CharField(
default="report.pdf",
verbose_name=_('Filename Pattern'),
help_text=_('Pattern for generating report filenames'),
max_length=100,
)
enabled = models.BooleanField(
default=True,
verbose_name=_('Enabled'),
@ -326,6 +349,7 @@ class TestReport(ReportTemplateBase):
return {
'stock_item': stock_item,
'serial': stock_item.serial,
'part': stock_item.part,
'results': stock_item.testResultMap(include_installed=self.include_installed),
'result_list': stock_item.testResultList(include_installed=self.include_installed)
@ -367,6 +391,7 @@ class BuildReport(ReportTemplateBase):
'bom_items': my_build.part.get_bom_items(),
'reference': my_build.reference,
'quantity': my_build.quantity,
'title': str(my_build),
}

View File

@ -21,7 +21,7 @@
<td><span class='fas fa-hashtag'></span></td>
<td>{% trans "InvenTree Version" %}</td>
<td>
<a href="https://github.com/inventree/InvenTree/releases">{% inventree_version %}</a>
<a href="https://github.com/inventree/InvenTree/releases">{% inventree_version %}</a>{% include "clip.html" %}
{% if up_to_date %}
<span class='label label-green float-right'>{% trans "Up to Date" %}</span>
{% else %}
@ -32,20 +32,20 @@
<tr>
<td><span class='fas fa-hashtag'></span></td>
<td>{% trans "Django Version" %}</td>
<td><a href="https://www.djangoproject.com/">{% django_version %}</a></td>
<td><a href="https://www.djangoproject.com/">{% django_version %}</a>{% include "clip.html" %}</td>
</tr>
{% inventree_commit_hash as hash %}
{% if hash %}
<tr>
<td><span class='fas fa-code-branch'></span></td>
<td>{% trans "Commit Hash" %}</td><td>{{ hash }}</td>
<td>{% trans "Commit Hash" %}</td><td>{{ hash }}{% include "clip.html" %}</td>
</tr>
{% endif %}
{% inventree_commit_date as commit_date %}
{% if commit_date %}
<tr>
<td><span class='fas fa-calendar-alt'></span></td>
<td>{% trans "Commit Date" %}</td><td>{{ commit_date }}</td>
<td>{% trans "Commit Date" %}</td><td>{{ commit_date }}{% include "clip.html" %}</td>
</tr>
{% endif %}
<tr>
@ -73,6 +73,14 @@
<td>{% trans "Submit Bug Report" %}</td>
<td><a href='{% inventree_github_url %}/issues'>{% inventree_github_url %}issues</a></td>
</tr>
<tr><td></td><td></td>
<td>
<span style="display: none;" id="about-copy-text">{% include "version.html" %}</span>
<span class="float-right">
<button class="btn clip-btn-version" type="button" data-toggle='tooltip' title='{% trans "copy to clipboard" %}'><i class="fas fa-copy"></i> {% trans "copy version information" %}</button>
</span>
</td>
</tr>
</table>
</div>

View File

@ -0,0 +1 @@
<a href="mailto:{{ mail }}">{{ mail }}</a>{% include "clip.html"%}

View File

@ -0,0 +1 @@
<a href="tel:{{ tel }}">{{ tel }}</a>{% include "clip.html"%}

View File

@ -0,0 +1,5 @@
# Version Information:{% load inventree_extras %}
InvenTree-Version: {% inventree_version %}
Django Version: {% django_version %}
{% inventree_commit_hash as hash %}{% if hash %}Commit Hash: {{ hash }}{% endif %}
{% inventree_commit_date as commit_date %}{% if commit_date %}Commit Date: {{ commit_date }}{% endif %}