2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-02-19 13:18:03 +00:00

Enhance plugin SN validation (#7942)

* Update function signature for 'validate_serial_number'

- Pass through stock item parameter
- Required if we want to exclude a particular item from that test

* Update documentation

* Docs fixes

* Add type annotations
This commit is contained in:
Oliver
2024-08-21 15:45:47 +10:00
committed by GitHub
parent f2f90dd1e4
commit e837e5d7d7
5 changed files with 129 additions and 20 deletions

View File

@@ -121,7 +121,7 @@ class SampleValidatorPlugin(SettingsMixin, ValidationMixin, InvenTreePlugin):
if d >= 100:
self.raise_error('Value must be less than 100')
def validate_serial_number(self, serial: str, part):
def validate_serial_number(self, serial: str, part, stock_item=None):
"""Validate serial number for a given StockItem.
These examples are silly, but serve to demonstrate how the feature could be used