Erpnext swap batches

i have two items ,wrong batches :

item 1 → batch 1
item 2 → batch 2

the batches should be :

item1 ->batch 2
item2 ->batch 1

is there a function i can use with frappe to swap the batches of these two items .
and the changes should be in all documents used these batches before ?

Erpnext won’t allow you to rename a batch, it is very limited. You won’t be able to reuse the same batch number for another item either.

One idea I’d like to try out someday is the following:

Use an arbitrary sequence number as batch naming.
Add a custom field ‘label’ to the batch table.
Use the label field as title, and enable title in link fields.

That way you can rename the label field. This label is shown in Title everywhere the batch is displayed (hopefully).

Another benefit for purchased goods is this would allow you to enter the supplier provided batch number as-is without having to worry about uniqueness if that batch was already used. I hate having to explain to my customers they have to alter the batch number because it must be globally unique in erpnext.

@guimorin thank you for response ,
i think the best approach in my case is to swap batches in all related documents that use the different batches and update the qty based on this .
the batch renaming is limitation in erpnext .