2
0
mirror of https://github.com/inventree/inventree-website.git synced 2025-12-15 00:38:15 +00:00
This commit is contained in:
matmair
2025-11-20 22:24:48 +00:00
parent 50876dcb95
commit ca915a4341
37 changed files with 252 additions and 157 deletions

View File

@@ -31,11 +31,11 @@
<meta property="og:url" content="/melektron/inventree-adv-sheet-label" />
<meta property="og:site_name" content="InvenTree" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2025-11-11T01:19:18+00:00" />
<meta property="article:published_time" content="2025-11-20T22:24:37+00:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="Inventree Adv Sheet Label" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"melektron"},"dateModified":"2025-11-11T01:19:18+00:00","datePublished":"2025-11-11T01:19:18+00:00","description":"A label printing plugin for InvenTree which provides support for printing labels on off-the-shelf label sheet layouts and adds some more useful features compared to the sheet label plugin included with InvenTree.","headline":"Inventree Adv Sheet Label","mainEntityOfPage":{"@type":"WebPage","@id":"/melektron/inventree-adv-sheet-label"},"url":"/melektron/inventree-adv-sheet-label"}</script>
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"melektron"},"dateModified":"2025-11-20T22:24:37+00:00","datePublished":"2025-11-20T22:24:37+00:00","description":"A label printing plugin for InvenTree which provides support for printing labels on off-the-shelf label sheet layouts and adds some more useful features compared to the sheet label plugin included with InvenTree.","headline":"Inventree Adv Sheet Label","mainEntityOfPage":{"@type":"WebPage","@id":"/melektron/inventree-adv-sheet-label"},"url":"/melektron/inventree-adv-sheet-label"}</script>
<!-- End Jekyll SEO tag -->
</head>
@@ -69,7 +69,7 @@
<p> melektron</p>
</span>
</a></span>
<span class="sm:ml-2 text-sm">last modified: 11 Nov 2025</span>
<span class="sm:ml-2 text-sm">last modified: 20 Nov 2025</span>
</h2>
<div class="flex-wrap md:flex md:flex-nowrap">
@@ -111,8 +111,26 @@
<h2 id="installation">Installation</h2>
<blockquote>
<p>Note:
This plugin currently supports InvenTree versions <strong>0.15.x</strong>. As of writing, version <strong>0.16.x</strong> is under development and its new API is partially supported. However, since that might still change at any time, compatibility is not yet guaranteed.</p>
<p>[!NOTE]
The latest version of this plugin currently supports the following InvenTree versions:</p>
<ul>
<li>
<strong>1.0.x</strong> (tested with version <strong>1.0.5</strong>)</li>
<li>
<strong>1.1.x</strong> (tested with version <strong>1.1.3</strong>)</li>
</ul>
<p>For older InvenTree versions, use version <code class="language-plaintext highlighter-rouge">1.2.2</code>, which supports the following InvenTree versions:</p>
<ul>
<li><strong>0.15.x</strong></li>
<li>
<strong>0.16.x</strong> (tested with version <strong>0.16.5</strong>)</li>
<li>
<strong>0.17.x</strong> (tested with version <strong>0.17.14</strong>)
Some even older or newer versions might also work, but have not been tested.</li>
</ul>
<p>If you are having trouble installing, see <a href="#common-issues">Common Issues</a> for possible solutions or create an issue.</p>
</blockquote>
<p>The simplest way of installing is by using the <code class="language-plaintext highlighter-rouge">Install Plugin</code> button on the InvenTree <code class="language-plaintext highlighter-rouge">Plugin Settings</code> page and then entering the package name:</p>
@@ -171,6 +189,20 @@ This plugin currently supports InvenTree versions <strong>0.15.x</strong>. As of
</tr>
</thead>
<tbody>
<tr>
<td>8160</td>
<td>US Letter</td>
<td>66.7mm x 25.4mm</td>
<td>3 columns x 10 rows</td>
<td>round</td>
</tr>
<tr>
<td>22805</td>
<td>US Letter</td>
<td>37.0mm x 37.0mm</td>
<td>4 columns x 6 rows</td>
<td>sharp</td>
</tr>
<tr>
<td>4780</td>
<td>A4</td>
@@ -192,6 +224,13 @@ This plugin currently supports InvenTree versions <strong>0.15.x</strong>. As of
<td>4 columns x 16 rows</td>
<td>round</td>
</tr>
<tr>
<td>7120-25</td>
<td>A4</td>
<td>35.0mm x 35.0mm</td>
<td>5 columns x 7 rows</td>
<td>sharp</td>
</tr>
<tr>
<td>7160-10</td>
<td>A4</td>
@@ -206,14 +245,63 @@ This plugin currently supports InvenTree versions <strong>0.15.x</strong>. As of
<td>3 columns x 8 rows</td>
<td>sharp</td>
</tr>
<tr>
<td>1367853</td>
<td>A4</td>
<td>48.5mm x 16.9mm</td>
<td>4 columns x 16 rows</td>
<td>sharp</td>
</tr>
<tr>
<td>4210</td>
<td>A4</td>
<td>38.1mm x 12.7mm</td>
<td>5 columns x 22 rows</td>
<td>sharp</td>
</tr>
<tr>
<td>1367586</td>
<td>A4</td>
<td>70.0mm x 36.0mm</td>
<td>3 columns x 8 rows</td>
<td>sharp</td>
</tr>
<tr>
<td>8724</td>
<td>A4</td>
<td>46.0mm x 11.1mm</td>
<td>4 columns x 21 rows</td>
<td>round</td>
</tr>
<tr>
<td>Avery 50x25-R</td>
<td>A4</td>
<td>50.0mm x 25.0mm</td>
<td>3 columns x 8 rows</td>
<td>round</td>
</tr>
<tr>
<td>Avery 105x42-R</td>
<td>A4</td>
<td>105.0mm x 42.0mm</td>
<td>2 columns x 7 rows</td>
<td>sharp</td>
</tr>
<tr>
<td>Avery 40x12-R</td>
<td>A4</td>
<td>40.0mm x 12.0mm</td>
<td>4 columns x 17 rows</td>
<td>round</td>
</tr>
</tbody>
</table>
<p>As of right now, this selection is limited to whatever layouts I personally own and use. If the paper layout you need is not included, please file an <a href="https://github.com/melektron/inventree-adv-sheet-label/issues/new?assignees=melektron&amp;labels=sheet+layout&amp;projects=&amp;template=sheet-layout.md&amp;title=New+Sheet+layout%3A+%5Blayout+name%5D">Issue with the “Sheet Layout” template</a>. See the <a href="#adding-new-layouts">Adding new layouts</a> for details.</p>
<p>This selection is limited to whatever users of this plugin have contributed. If the paper layout you need is not included, please file an <a href="https://github.com/melektron/inventree-adv-sheet-label/issues/new?assignees=melektron&amp;labels=sheet+layout&amp;projects=&amp;template=sheet-layout.md&amp;title=New+Sheet+layout%3A+%5Blayout+name%5D">Issue with the “Sheet Layout” template</a> or - even better - contribute it yourself. See the <a href="#adding-new-layouts">Adding new layouts</a> section for details.</p>
<p>You can also select one of the two <code class="language-plaintext highlighter-rouge">Auto</code> sheet layout presets. These will automatically select the correct sheet layout for the label template you are printing. This is done in one of three ways:</p>
<ul>
<li>If you have a specific layout thats always used for a specific template, you can add the <code class="language-plaintext highlighter-rouge">{"sheet_layout": "..."}</code> metadata key to your label template configuration (replace … with the identifier of the layout. This might not be the same as the display name, see <a href="https://github.com/melektron/inventree-adv-sheet-label/blob/main/advanced_sheet_label/layouts.py#L77">here</a> what the identifier is). This is the cleanest way configure the correct layout for your templates.</li>
<li>If you have a specific layout thats always used for a specific template, you can add the <code class="language-plaintext highlighter-rouge">{"sheet_layout": "..."}</code> metadata key to your label template configuration (replace … with the identifier of the layout. This might not be the same as the display name, see <a href="https://github.com/melektron/inventree-adv-sheet-label/blob/main/advanced_sheet_label/layouts.py#L77">here</a> what the identifier is). This is the cleanest way configure the correct layout for your templates, but it is no longer easily available as of InvenTree version <code class="language-plaintext highlighter-rouge">1.0.0</code> due to the Django admin UI being removed.</li>
<li>If the selected template template has no such metadata, the plugin will attempt to find a layout with exactly the required label size and use that one. If multiple matches are found, the first one is selected while preferring ones with round or sharp corners depending on your selection.</li>
<li>If no exact matches are found, the closest layout that can fit your label template will be selected and shown to the user in an error message. The user can then decide to use this option by selecting the <a href="#ignore-label-size-mismatch">Ignore label size mismatch</a> switch.</li>
</ul>
@@ -268,7 +356,7 @@ This plugin currently supports InvenTree versions <strong>0.15.x</strong>. As of
<ul>
<li>Manually selecting a sheet layout that doesnt match the label template: <img src="https://raw.githubusercontent.com/melektron/inventree-adv-sheet-label/main/images/err_selected_layout.png" alt="Error selected layout size does not match">
</li>
<li>When automatic layout selection is enabled and the label template specifies a sheet layout but its label size does not match that of the template: <img src="https://raw.githubusercontent.com/melektron/inventree-adv-sheet-label/main/images/err_metadata_layout.png" alt="Error template metadata layout does not have the expected size">
<li>When automatic layout selection is enabled and the label template specifies a sheet layout but its label size does not match that of the template (no longer relevant as of InvenTree <code class="language-plaintext highlighter-rouge">1.0.0</code>): <img src="https://raw.githubusercontent.com/melektron/inventree-adv-sheet-label/main/images/err_metadata_layout.png" alt="Error template metadata layout does not have the expected size">
</li>
<li>When automatic layout selection is enabled but the label template doesnt specify any layout in the metadata and no exact size match was found: <img src="https://raw.githubusercontent.com/melektron/inventree-adv-sheet-label/main/images/err_no_size_match.png" alt="Error no metadata and no exact size match found">
</li>
@@ -320,6 +408,12 @@ This plugin currently supports InvenTree versions <strong>0.15.x</strong>. As of
<p>This setting allows you to specify which sheet layout is selected by default when opening the printing dialog. It makes sense to set this either to some <em>Auto</em> option or to the layout you are using the most. The default is <code class="language-plaintext highlighter-rouge">Auto (round)</code>, which is probably fine for most use-cases.</p>
<h2 id="common-issues">Common Issues</h2>
<h3 id="no-matching-distributionfound--could-not-find-a-version-that-satisfies-the-requirement">“No matching distributionfound” / “Could not find a version that satisfies the requirement”</h3>
<p>This means that the Python version installed on the InvenTree host is too old for the plugin. This error may occur when trying to install plugin versions up to <code class="language-plaintext highlighter-rouge">1.2.2</code> on an InvenTree instance installed bare-metal or via the package installer on a system with Python 3.9. This is because the plugin used to require Python &gt;= 3.11, which is the version used in the containers, therefore working for most setups. As of plugin version <code class="language-plaintext highlighter-rouge">1.3.0</code>, the version requirement has been reduced, and this should no longer occur.</p>
<h2 id="contribution">Contribution</h2>
<p>If you have ideas for new features, found typos, have encountered a bug or want to add more sheet layouts, feel free to contribute to this plugin by <a href="https://github.com/melektron/inventree-adv-sheet-label/issues/new/choose">filing an Issue</a> or <a href="https://github.com/melektron/inventree-adv-sheet-label/compare">creating a Pull Request</a>. See <a href="#plugin-development-setup">Plugin development setup</a> to learn how you can set up your development environment to test your modifications.</p>
@@ -330,11 +424,11 @@ This plugin currently supports InvenTree versions <strong>0.15.x</strong>. As of
<p>If you have encountered a problem or a bug with the plugin, please file an <a href="https://github.com/melektron/inventree-adv-sheet-label/issues/new?assignees=melektron&amp;labels=bug&amp;projects=&amp;template=bug-report.md&amp;title=">Issue with the Bug Report template</a>.</p>
<p>The template requires you to provide a screenshot of your label template configuration. You can get this by going to https://your.inventree.url/admin/label/ for InvenTree 0.15.x or https://your.inventree.url/admin/report/labeltemplate/ for InvenTree 0.16.x and selecting the template you were trying to print when the problem ocurred. You need administrator privileges to do this. If you dont have them, ask your administrator. This page might look something like this:</p>
<p>The template requires you to provide a screenshot of your label template configuration. You can get this by going to https://your.inventree.url/web/settings/admin/labels and <code class="language-plaintext highlighter-rouge">Edit</code>ing the template in question. You need administrator privileges to do this. If you dont have them, ask your administrator. This page might look something like this:</p>
<p><img src="https://raw.githubusercontent.com/melektron/inventree-adv-sheet-label/main/images/template_config_example.png" alt="Example template configuration screenshot"></p>
<p>In addition to this screenshot, you will be asked to attach the label template file which can be downloaded by clicking on the link next to “Currently:” in the above shown page. Please make sure this file doesnt contain any confidential data and remove it if it does.</p>
<p>In addition to this screenshot, you will be asked to attach the label template file which can be downloaded by clicking on the Template in the list and copying the code. Please make sure this file doesnt contain any confidential data and remove it if it does.</p>
<p>You will also be asked to provide some other information about when and how the bug ocurred which is described in the template.</p>
@@ -396,7 +490,8 @@ This plugin currently supports InvenTree versions <strong>0.15.x</strong>. As of
</blockquote>
<blockquote>
<p>It appears that this doesnt work. It also didnt seem to work when placing the “git+…” URL in package field in the UI. For me, I have been able to install the plugin directly from GitHub by stopping the InvenTree server and then installing directly using pip:</p>
<p>Plugins installed in this way seem to not be added to plugins.txt file properly in InvenTree version <code class="language-plaintext highlighter-rouge">1.0.5+</code>. For me, I have been able to install the plugin directly from GitHub by stopping the InvenTree server, adding the URL to the plugins.txt file and then running <code class="language-plaintext highlighter-rouge">invoke plugins</code>.
Alternatively, you can install it directly using pip:</p>
<div class="language-bash highlighter-rouge">
<div class="highlight"><pre class="highlight"><code>pip uninstall inventree-adv-sheet-label <span class="c"># uninstall normal package</span>
pip <span class="nb">install </span>git+https://github.com/melektron/inventree-adv-sheet-label.git