Can I change in the db the warehouse name in Sales Invoices to match the renamed Warehouse?

I recently renamed a Warehouse, from WH1 to WH2, so now the Sales Invoices with the old WH1 won´t appear in a report or list view filter because WH1 doesn´t exist anymore.

I see that when I rename a Cost Center, the old name of the Cost Center is replaced with the new one in ALL Sales Invoices that had the old name

So, - Can I change in the db the warehouse name in Sales Invoices to match the newly changed Warehouse name?

Thanks

Yes, you can change the warehouse names via the database, but I’m not sure how it’ll affect the stock entry history and the ledgers. It might throw the entire system into a validation hell.

So please be careful when editing the database directly.

Hi. Thanks for your reply

I know how to change it in the database, what worries me is how those changes directly on the database affect other parts of the system

@CostaRica my recomendation!

1 - create again the “WH1” on the system

with bench console

frappe.rename_doc("Warehouse", "WH1", "WH2", merge=True)
frappe.db.commit()

It will guaretee that everything needed will be properly updated!

1 Like

Hi @max_morais_dmm Thanks a lot!

What other Doctypes does this rename_doc command work with?

@CostaRica basically for any doctype

1 Like