Enable Dark Mode!
commands-lines-in-odoo.jpg
By: Jibin

Commands Lines in Odoo

Technical

The blog contains how to use command lines for odoo.For working/deploy odoo on server, we probably use command lines. We may have many cases for using the command lines, for example-if we need to upgrade a module without using GUI,then the only option is to use command lines to do that.
Upgrading a module 
“/opt/odoo/odoo-bin -c /etc/odoo-server.conf -u all”
The above command will help you to upgrade all the modules in all database.If you need to upgrade a module from a particular database then we have to specify the database.
“/opt/odoo/odoo-bin -c /etc/odoo-server.conf -d dbname -u all”
So here the dbname must be the name of your database.
If you want to upgrade a particular module you can specify the module name instead of all.
“/opt/odoo/odoo-bin -c /etc/odoo-server.conf -d dbname -u module_name”

Installing a module
To Install a new module using command line,use 
“/opt/odoo/odoo-bin -c /etc/odoo-server.conf -d dbname -r role -w password -i module_name”
Here the role is the name of postgres user/database user and the password is the password for that role.
Sometimes when we try to run a server to upgrade the module, we may be hit with “the port is already in use”.In order to avoid this we must stop the odoo server.

To stop the server we can use: 
sudo systemctl stop odoo.service
Which will help to stop the running odoo server.
So if we hit with port running issue and we need to stop another odoo service, use:
ps aux | grep odoo
This will list out the running odoo services and we can kill/stop the service by,
kill -9 processid
The processid will be displayed on the list of the running services.
 
To change xmlrpc port
sudo /opt/odoo/odoo-bin -c /etc/odoo-server.conf --xmlrpc-port=8070
This will change the default or the xmlrpc port set on the config and run on the mentioned port number.

List Out particular Database
sudo /opt/odoo/odoo-bin -c /etc/odoo-server.conf --db-filter test_db
This command will help in filtering out the database.Here test_db is the name of db.So it will filter out and show only the database with name test_db.If it contain multiple name like this i.e test_db1,test_db_one etc, this command will list all database name with test_db.

If you need to get the odoo version, use
sudo /opt/odoo/odoo-bin -c /etc/odoo-server.conf  --version
The other options available are:
1.  --db_host=HOST  
This  specify the database host
2.  --db_port=PORT   
This specify the database port
3.  --db_maxconn=MAXCONN
 This specify the the maximum number of physical connections to postgresql
4. --debug
This enable the debug mode    
5. --no-database-list
This will disable all the database list
6. --limit-time-cpu 60
This will stop/kill the worker if the specified limit is exceeded for each request. Here 60 is the limit.60 is the default value for this,but on using the command line we have to specify an argument for limit-time-cpu.
7. --limit-time-real 120
This will stop/kill the worker if the specified limit is exceeded for processing a request.For this the default value/limit is 120

All the above mentioned are also specified in the .conf file.
odoo_bin shell  - This command help in launching console environment for odoo which help in interaction with ORM
Odoo cloc is a tool to count the number of relevant lines written in
Python, Javascript or XML. 
It can be counted in two ways, either by providing a path:
odoo-bin cloc -p module_path
Or by providing the name of a database:
odoo-bin cloc --addons-path=dirs -d database
Multiple path can be given
        odoo-bin cloc -p /path1 -p /path2.

So this is about the commonly used command lines for odoo.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment

 


whatsapp
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message