Skip to content

yosa-odoo/odoo-toolbox

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tools to manage the DBs (switch, save & restore)

Base

All scripts are based on the idea that we are working on one DB at the time. To define and get that current DB's name, setdb and getdb must be used

  • setdb will write the argument in a hidden file. It also writes the DB on the .odoorc file (but this line is not mandatory and can be removed)
  • getdb simply reads and returns the content of the hidden file

Save & Restore

Suppose an initialized DB with a specific configuration on it. I want to save its state and have the possibility to restore that state

  • savedb will save the current DB (getdb) into a new one. Suppose X is the name of the current DB:
    • If an argument Y is given to savedb: the saved DB is called X__Y
    • Otherwise: the saved DB is called X__SAVEPOINT
  • restoredb tries to find a saved state of the current DB (getdb) and restores it. Suppose X is the name of the current DB:
    • If an argument Y is given to restoredb: the script tries to find a saved state of X called Y (i.e., it searches for a DB called X__Y). If such a state exists, it will restore it on X
    • Otherwise, it tries to find a saved state called SAVEPOINT and does the same than above

/!\ The filestore is never saved nor restored. In most cases, it is not useful.

Flow example

I want to work on a DB called 1234567-15.0:

setdb 1234567-15.0

I run Odoo, I create some products and set a specific configuration. I don't want to lose it:

savedb config

Then I do some stuff and I create a SO. I'm going to validate it but I would like to save the current state and I don't care about the name:

savedb

Again, I confirm the SO and do some stuff. Finally, I want to go back either before the SO creation or before its validation:

restoredb config
restoredb

Misc

  • copydb takes two arguments X and Y and copies X on a new DB called Y. It is used by savedb and restoredb

  • killodoo kills all Odoo processes. It is executed by copydb

  • ldb lists all databases

  • dropall: for each argument X, it drops all databases that contain X in their name

  • sdv <version>: uses setdb with the value of the current db (getdb) and concatenated with '-<version>'

  • getticket : extract the ticket number from the db's name

  • branch <branch-s name> -> git checkout -b <version>-<#ticket>-<branch's name>-yosa

  • cv <version>: change the value of the Xenv symbolic link and checks out version if in Odoo

  • xenv : prints out the current point value of the symbolic link

  • changexenv <target> : change the value of the symbolic link with the <target>'s value

  • .bash_completion allows the user to auto complete the arguments of setdb, savedb and restoredb in his terminal

  • renamedb: takes one argument X and will rename the current DB into X

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 66.5%
  • Python 29.7%
  • JavaScript 3.8%