Ensuring OEM Serial numbers uniqueness

Hello,

I use in manufacturing several products with very similar serial number series. It is only a matter of time when they match. So I decided to “wrap” the OEM/MFR serial with my own, ERPNEXT-generated and guaranteedly unique serial. It was relatively easy to add a custom field “custom_mfr_ser” to store that psuedo-unique serail and define the series for generating my own. But then I ran into a problem. I want to continue using the Purchase Infoice and Reciept forms to scan the OEM barcodes on item arrival, but the ERPNEXT hardcoded saving the scanned codes into “serial_no” and “name” fields. So far, one option I found is to rewrite the make_serial_nos() from serial_and_batch_bundle.py to save them in the “custom_mfr_ser” field - which looks a bit clumsy and dangerous. And another one to use doc_events hook on Purchase Receipt / Purchase Invoice before_submit + after_submit, but I am not sure if that is all what is needed to change: the new field must be used in parallel with old ones during all operations with serials - e.g. search, reporting…

So I would like to ask if there is a better way to solve that? I tried to find something on the subject, but only got the same question raised 2 years ago with no answers…