Uninstalling module from terminal

1-Go to your odoo installation folder where you will find odoo-bin

ex :   cd /opt/odoo15/odoo

Switch to odoo user 

sudo su odoo

Execute the command 

python3 odoo-bin shell -d dbname --addons-path=/opt/odoo15/custom-adons1,/opt/odoo15/customadons

then odoo will start in terminal then issue the command 

self.env['ir.module.module'].search([('name', '=', 'module_name')]).button_immediate_uninstall()"

if the command fails try 

self.env['ir.module.module'].search([('name', '=', 'module_name')]).button_immediate_uninstall()"

Thanks for  Muhammad Awais from odoo forum.

Stock unreserved quantities fix for in consistent stock moves
odoo 12 / 13 fix for in consistent stock moves try the solution for later versions and comment pls.