Skip to main content

InvenTree plugin to automatically generate and assign Internal Part Numbers to parts

Project description

License: MIT

Introduction

This is a plugin for InvenTree. Installing this plugin enables the automatic generation if Internal Part Numbers (IPN) for parts.

Installation

To automatically install the plugin when running invoke install: Add inventree-ipn-generator to your plugins.txt file.

Or, install the plugin manually:

pip install inventree-ipn-generator

For the plugin to be listed as available, you need to enable "Event Integration" in your plugin settings. This setting is located with the Plugin Settings on the settings page.

Settings

  • Active - Enables toggling of plugin without having to disable it
  • On Create - If on, the plugin will assign IPNs to newly created parts
  • On Change - If on, the plugin will assign IPNs to parts after a change has been made. Enabling this setting will remove the ability to have parts without IPNs.

Pattern

Part Number patterns follow three basic groups. Literals, Numerics, and characters. When incrementing a part number, the rightmost group that is mutable will be incremented. All groups can be combined in any order.

A pattern cannot consist of only Literals.

For any pattern, only the rightmost non-literal group will be incremented. When this group rolls over its max, the next non-literal group to the left will be incremented. Example: Given the groups (named for demo): L1C1N1C2L2 Incrementing follows this order: C2, N1, C1.

NOTE: When C1 in the above example rolls over, the plugin will loop back to the first IPN. This will cause duplicate IPNs if your InvenTree allows duplicate IPNs. If your InvenTree does not allow duplicate IPNs, this will cause an error at the moment! This will be addressed in an upcoming update.

Literals (Immutable)

Anything encased in () will be rendered as-is. no change will be made to anything within.

Example: (A6C) will always render as "A6C", regardless of other groups

Numeric

Numbers that should change over time should be encased in {}

  • {5} respresents a number with max 5 digits
  • {25+} represents a number 25-99

Example: {5+}{3} will result in this range: 5000-9999

Characters

Characters that change should be encased in []

  • [abc] represents looping through the letters a, b, c in order.
  • [a-f] represents looping through the letters from a to f alphabetaically

These two directives can be combined.

  • [aQc-f] represents:
    • a, Q, c-f

Examples

  1. (AB){3}[ab] -> AB001a, AB001b, AB002a, AB021b, AB032a, etc
  2. {2}[Aq](BD) -> 01ABD, 01qBD, 02ABD, 02qBD, etc
  3. {1}[a-d]{8+} -> 1a8, 1a9, 1b8, 1b9, 1c8, 1c9, 1d8, 1d9, 2a8, etc

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inventree_ipn_generator-0.1.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

inventree_ipn_generator-0.1.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file inventree_ipn_generator-0.1.1.tar.gz.

File metadata

  • Download URL: inventree_ipn_generator-0.1.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for inventree_ipn_generator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 255edc89e9d5e8964b8402c28bc36dea70d074e06c18ecaaeb2ae5368001fb72
MD5 84695b9e930bccd9fee90c29d3de5741
BLAKE2b-256 b0867d30c960a54d9ac21c3a9e94e155a329d174ee29b0074636a5f78af1d72d

See more details on using hashes here.

File details

Details for the file inventree_ipn_generator-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for inventree_ipn_generator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bd446124e95a63751df632cfa6a6b02a6f058168fc5f620ffd5eb521ea73e125
MD5 17b24d9d6afe2532ab62b7d4dad47c05
BLAKE2b-256 251b68aac9a76a1ac4d48a339f16c7737cbe59c51788063f0cd70f35d09a35be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page