mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-26 17:48:54 +00:00
[bug] fixes for batch code generation (#13375)
- Improve template validation - Ensure generated batch code fits within field length - Fix docs
This commit is contained in:
1 parent
a44d6da500
commit
e309531322
6 files changed
+114
-7
No files matched your search
@@ -22,7 +22,11 @@ Multiple stock items may share the same batch code without restriction, even acr
|
||||
|
||||
#### Generating Batch Codes
|
||||
|
||||
Batch codes can be generated automatically based on a provided pattern. The default pattern simply uses the current date-code as the batch number, however this can be customized within a certain scope.
|
||||
Batch codes can be generated automatically based on a provided pattern, using the `STOCK_BATCH_CODE_TEMPLATE` setting. By default this pattern is empty, and no batch code is generated. The pattern uses the Django template language, and can make use of the context variables listed below.
|
||||
|
||||
For example, the pattern `{% raw %}B{{ year }}-{{ week }}{% endraw %}` would generate a batch code such as `B2024-51`.
|
||||
|
||||
If the pattern is invalid, it cannot be saved. If an error occurs while a batch code is being generated, the error is logged and no batch code is assigned. Generated batch codes are truncated to a maximum of 100 characters.
|
||||
|
||||
{{ image("stock/batch_code_template.png", title="Batch code pattern") }}
|
||||
|
||||
|
||||
Reference in new issue
Block a user