This is just a little customization of the Docker Odoo Base created by Tecnativa for Boxwise. The complete doc can be fount here
Within a few commands you can create use a lot of odoo dev tools, e.g. the python debugger wdb or the odoo-shell.
git clone https://github.com/boxwise/boxwise-doodba.git
cd boxwise-doodba
chown -R $USER:1000 odoo/auto
chmod -R ug+rwX odoo/auto
export UID GID="$(id -g $USER)" UMASK="$(umask)"
docker-compose -f setup-devel.yaml run --rm odoo
ln -s devel.yaml docker-compose.yml
docker-compose run --rm odoo --stop-after-init -i module_auto_update,boxwise_wms,boxwise_wms_pampiraiki && docker-compose run --rm odoo autoupdate --stop-after-init
docker-compose up
-
Clone this repo.
-
Enter the folder.
cd boxwise-doodba
-
Make sure that the folder odoo/auto has the right access rights.
chown -R $USER:1000 odoo/auto chmod -R ug+rwX odoo/auto
-
Populate the id variables
UID
,GID
andUMASK
.export UID GID="$(id -g $USER)" UMASK="$(umask)"
We recommend to put this line in to your
.bashrc
-
Build your development setup.
docker-compose -f setup-devel.yaml run --rm odoo
-
Create a link of the development docker-compose file
devel.yaml
to make it your default docker-compose file.ln -s devel.yaml docker-compose.yml
-
Install all boxwise modules and the module_auto_update module.
docker-compose run --rm odoo --stop-after-init -i module_auto_update,boxwise_wms,boxwise_wms_pampiraiki && docker-compose run --rm odoo autoupdate --stop-after-init
The second command creates a hash stored in the db to track if modules changed over time.
You are now ready to go. All boxwise repos and modules are already checked out and installed.
-
Start your development environment.
docker-compose up
localhost:11069 or 127.0.0.1:11069
email: admin
password: admin
Feel free to add useful commands you found in this section.
Some section titles are links, too.
To activate the developer mode in the odoo frontend, there two ways:
1. Add `debug` in the url --> `localhost:11069/web?debug#....` or
2. Go to settings and click the link hidden beneath the credentials on the far right!
When you pulled changes to the boxwise-doodba, you should rerun parts of the installation. Since they are explained above, here just the commands in short.
export UID GID="$(id -g $USER)" UMASK="$(umask)"
docker-compose -f setup-devel.yaml run --rm odoo
docker-compose -f devel.yaml up --build
-
If you changed CSS/JS press F5
-
If you changed the contents of a preexisting view in a preexisting XML file, on Odoo v9+: F5
-
If you changed some python code that doesn't involve database modifications:
docker-compose restart odoo odoo_proxy
-
Otherwise (add/rm data to XML files, add/rm XML files, change model definitions):
docker-compose run --rm odoo autoupdate && docker-compose restart odoo odoo_proxy
To update all modules which have changed since the last update run
docker-compose run --rm odoo autoupdate
If you want to update a specific addon run
docker-compose run --rm odoo odoo -u addon1,addon2 --stop-after-init
If you need to install any other custom modules, e.g. from the odoo community (OCA), then adjust the files odoo/custom/src/repos.yaml
and odoo/custom/src/addons.yaml
. Check out the original doc for more help and some examples. BTW, our Boxwise modules and repos are specified there, too.
After adjust the .yaml
-files, repeat the steps 4.) and 5.) of the installation! Please stop all running docker containers for this step!
To finally install the modules in the instance run
docker-compose run --rm odoo odoo -i addon1,addon2 --stop-after-init
To put breakpoints in your code, put this in your python scrict:
import wdb
wdb.set_trace()
To acces wdb, browse http://localhost:1984
To start the odoo-shell run
docker-compose run --rm odoo odoo shell
If you want to start the odoo-shell hooked up to another database than the doodba default, run
docker-compose run --rm odoo odoo shell -d <your_database>
Open a browser window and go to
http://localhost:11069/web/database/manager
There you can choose your own log in credentials and leave out the demo data of the default installation.
Open odoo shell and import the following
from openerp.service import db
Here, some useful commands
#help(db)
db.list_dbs()
#Prove list of avalibale db
db.exp_drop('dbname')
#Drop an existing db
db.exp_duplicate_database('olddb','newdb')
#Duplicate an existing db
db.exp_create_database('dbname',None,'en_US','username','password')
#Create a new db
Your tests must be stored in the tests
-subfolder of your module.
A test class should look like:
class TestRandomIdSequence(common.TransactionCase):
def setUp(self):
# this is a method which sets up some global variables needed in the tests
...
@common.post_install(True) # this one executes test on module update
@common.at_install(True) # his one executes test on module installation
def test_random_id_sequence(self): # test methods have to start with 'test_' for the odoo test autodiscovery process
...
To run the unittests
docker-compose run --rm odoo unittest addon1,addon2
To optimize all VSCode run the setup script in .vscode!
Tecnativa updated their odoo docker image recently which breaks the access to the database manager. A issue is filed and they are on it to solve it. Until then, you can create a new database by changing the fields DOODBA_ENVIRONMENT
and PGDATABASE
in devel.yaml
:
environment:
DOODBA_ENVIRONMENT: "${DOODBA_ENVIRONMENT-<my new database>}"
PTVSD_ENABLE: "${DOODBA_PTVSD_ENABLE:-0}"
PGDATABASE: &dbname <my new database>
In your browser you can log into your new database by typing:
localhost:11069/web?db=<my new database>