Replies: 2 comments 1 reply
-
I also tried it with the model but then it always says that "Serial number cannot be empty"
|
Beta Was this translation helpful? Give feedback.
1 reply
-
@NerosKi I think the issue might be here: Can you try changing the code from: # If the serial number is set, make sure it is not a duplicate
if self.serial:
self.serial = str(self.serial).strip()
try:
self.part.validate_serial_number(self.serial, self, raise_error=True)
except ValidationError as exc:
raise ValidationError({'serial': exc.message}) to # If the serial number is set, make sure it is not a duplicate
if self.serial:
self.serial = str(self.serial).strip()
try:
self.part.validate_serial_number(self.serial, self, raise_error=True)
except ValidationError as exc:
raise ValidationError({'serial': exc.message}) This will run the serial number through the custom validator, even if it is empty. Currently this is not checked. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How can I make the serial number field a required field when adding stock? I've managed to do it for the batch code by implementing a custom plugin:
However the validate_serial_number function does not trigger when the field is empty, unlike the validate_batch_code. When I put e.g. "aaa" in the lot number I do get a validation error but when it is empty, it accepts it without error.
Also when adding new stock, since that field is different, it is possible to add stock there without a serial number
Beta Was this translation helpful? Give feedback.
All reactions