Show Menu
Cheatography

BT Cheat Sheet (DRAFT) by

BT Tools and Procedures.

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Migrate a module

1. Create BT task in Internal Odoo.
2. Create branch 16.0.<­tas­k_c­ode> from 16.0.
3. Execute migrat­ion­_script with the module desired and the branch just created.
python3 ~/scri­pt_­mov­e_m­odu­les.py --modules thurbo­_sw­issdec --sour­ce_repo git@gi­thu­b.com:<o­wne­r>/­<re­po>.git --sour­ce_­branch 10.0 --targ­et_repo git@gi­thu­b.com:<o­wne­r>/­<re­po>.git --targ­et_­branch 16.0.<­tas­k_c­ode>
4. Use the OCA odoo-m­odu­le-­migrate tool.
odoo-m­odu­le-­migrate --dire­ctory <pa­th> --modules <mo­dul­e_1­,mo­dul­e_2­,mo­dul­e_3> --init­-ve­rsi­on-name 10.0 --targ­et-­ver­sio­n-name 12.0 --no-c­ommit
5. Migrate following OCA guidel­ines.
6. Install in local and fix all problems.
7. Add docstrings and docume­nta­tion.
8. Define unit tests.
9. Update README.
10. Commit and Push, create PR and assign to review it.

README

Command
python3 -m mainta­ine­r-t­ool­s.t­ool­s.g­en_­add­on_­readme --org-name "­bra­int­ec" --addo­n-dir /home/­moc­a1/­Bra­int­ecP­roj­ect­s/<­pro­jec­t_f­old­er>­/re­pos­/<p­roj­ect­>/<­mod­ule> --repo­-name "­<pr­oje­ct>­" --no-c­ommit --branch <ma­in(­16.0­)>
DESCRI­PTION
(MANDATORY) It explains what the module is about.
ORIGIN­AL_­AUTHORS
(MANDATORY) Who has contri­buted to an existing version.
CONTRI­BUTORS
Who has initially being involved in the first design
CONFIGURE
How to configure the module before using it.
Do NOT forget to add the BT icon.

Git Submodules

Add
git submodule add -b <br­anc­h> git@gi­thu­b.com:<o­wne­r>/­<re­po>.git ext/<r­epo>
Update
git submodule update <--­opt­ion­s>
Update options:

--init: Initia­lizes submod­ules, cloning them and setting them to a specific commit if they haven't been initia­lized before.

--force: Forces submodule update, ignoring the commit inform­ation stored in the main repository and ensuring that submodules are updated.

--remote: Updates submodules to the latest commit of their remote branch, useful when submodules track a remote branch for updates.

Docker Deploy

Build
bt deploy build -s <se­rve­r> -p <pr­oje­ct>­:<b­ran­ch>
Update
bt deploy update -s <se­rve­r> -p <pr­oje­ct>­:<b­ran­ch> -d <DB>

Code checks

bt test code-q­uality <mo­dul­e>

Docker Shell

bt docker shell

Solve merging conflict

resolv­e_c­onf­lic­ts_­step_1 <or­igi­n_b­ran­ch> <de­st_­bra­nch>
resolv­e_c­onf­lic­ts_­step_2 <or­igi­n_b­ran­ch> <de­st_­bra­nch>
resolv­e_c­onf­lic­ts_­step_3 <de­st_­bra­nch>
Add script from Fixing conflicts in Test PR into $HOME/.bashrc.

Then execute
. $HOME/.bashrc
in terminal to apply changes.
 

PyCharm Run config­uration

Run
odoo-bin -d <DB> -i <in­sta­ll_­mod­ule­s> -u <up­dat­e_m­odu­les> <--­i18­n-o­ver­wri­te>
Test
odoo_bin -d <DB> -i <mo­dul­es> --test­-ta­gs=­<mo­dul­es> --stop­-af­ter­-init

Download Server DB

Command
bt docker load-data <se­rve­r>
--live
Retrieves the current status of the DB on server.
--skip­-tables
Skips unnece­ssary tables like messaging and also filestore.
-clean­-script
Allows to indicate a certain clean script as a parameter.

BT Transl­ations

1. Install bt_tra­nsl­ation
Add bt_utils module to your project and install bt_tra­nsl­ation.
2. Export transl­ations on Settings app
Check Use BT Export.
3. Compare both PO files
On PyCharm, click on bt_exp­ort­ed.po and .po files and press Ctrl+D.
4. Fix them and repeat the process until they are identical.