Changing Stock setting valuation method from DB

hi. i want to change stock setting option valuation method directly from DB. does anyone have the solution how i can do this. Please let me know

Changing the valuation method directly in the database is not recommended as it could potentially cause issues with stock transactions. However, if you still need to proceed with it, here is an example query.

UPDATE `tabSingles` SET value='FIFO' WHERE `doctype`='Stock Settings' AND `field`='valuation_method';

Please keep in mind the risks involved, and the choice is ultimately yours.

Thanks for your response. can you elaborate how it causes with stock transactions. If i removed all stock before updating through DB and after updating i insert stock balance again. is there still any chance to have any issues with stock transactions?

what’s the other option i can used for changing valuation method as i have to change it because system is running on FIFO method which is not my client choice. He want to use Moving average method but when i change it from stock setting (UI) it gives me error Can’t change the valuation method, as there are transactions against some items which do not have its own valuation method

If you don’t need any data in the system, start by deleting all transactions. To do this, go to the Company list, open the company, click on “Manage,” then select “Delete Transactions.”

Enter your password and company name to confirm. This action will clear all transaction history. Afterward, you can change the stock valuation method as needed in the stock settings.

which types of transactions will be deleted is it related to stock transactions or it deleted all stock transactions. will it delete Sales order and purchase order too.

i have tried your solution on test it deleted all sales order and other documents which is not i want. thanks for your support but i think from changing DB is better way for me.