-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the metricwise_odoo
wiki!
MetricWise is using Odoo 15 Community edition. Their repository is based on direct changes to Odoo's core code using a patching system, which can be treated as a black box for Blue Stingray's purposes. For updates, we can branch off of 15.0
, make the required changes, then submit a PR upstream to MetricWise/odoo and its 15.0
branch.
For simplicity, you may want to specify the 15.0
branch to start
git clone --branch=15.0 [email protected]:gobluestingray/metricwise_odoo.git metricwise
- Create or edit the
.git/info/exclude
file so that it contains the following:- This ensures that the Docker-related files are not added to the repo. MetricWise has their own process for this, so we want to keep ours out of things.
docker
docker-compose.yml
- Patch the repo to add the Blue Stingray Docker-related setup
- Download the patch file
- Apply the patch
cd /path/to/repo_root
patch -p1 < /path/to/metricwise_docker.patch
After performing First-Time Setup, you can use docker-compose
commands normally. Get started with docker-compose up -d
and access the site at http://localhost:8069
The Odoo log can be monitored using
tail -f docker/log/odoo.log
This project doesn't have access to invoke
commands, so how do we invoke debug
? We can add ipdb
's set_trace
in our code as normal. In order to monitor the breakpoints, we can run the following command:
docker attach --detach-keys="ctrl-c" $(docker ps -q --filter name=<directory_name>_<container_name>)
For example, if you cloned this repo into a default directory named metricwise_odoo
, then that command would look like:
docker attach --detach-keys="ctrl-c" $(docker ps -q --filter name=metricwise_odoo_web)
For MetricWise, branch names and commit messages will be slightly different than our normal format.
- For Branches, omit the PM Task Number from the branch name.
feature/15.0/example
- For Commits, prepend the Jira Task Number to the commit message. Additionally, exclude the Task Link in the commit messages.
[BLUE-1][ADD]...
- Since we are omitting the Task Link in the commit messages, we will instead be manually adding this to the PR description when creating the Pull Request. This should maintain the same format as our current PR descriptions. This is to keep the link to our internal task, while keeping our internal processes out of the actual commits.
-
Once a PR has been approved internally, it will then be submitted to MetricWise for review. This will be done by creating a second Pull Request into the upstream repo, MetricWise/odoo. This second PR will not be merged, but instead a patch will be generated from it once approved by MetricWise.
-
Before submitting the Pull Request upstream, ensure the branch is up-to-date with the upstream 15.0 branch, by rebasing with the -i flag. Drop any interstitial commits not of your creation.
git rebase -i upstream/15.0
-
To open a Pull Request to the upstream repo, go to the Pull Requests Tab, and select the New Pull Request button. Set the base repository to MetricWise/odoo on the 15.0 branch.
-
Adam would also like a second PR into MetricWise/odoo-metricwise to facilitate automated testing. Since the gobluestingray/metricwise_odoo is a fork of MetricWise/odoo and not MetricWise/odoo-metricwise, PRs cannot be directly created into it. Instead, these will be PR'd by creating a patch in the Dockerfile on the gobluestingray/odoo-metricwise repo, which will be PR'd into the upstream MetricWise/odoo-metricwise repo.
-
To do this, first create a branch with the JIRA task # as the name on the gobluestingray/odoo-metricwise repo.
-
Then, add the code as a patch to the Dockerfile found in
docker/odoo/Dockerfile
, in the following format:
ADD https://patch-diff.githubusercontent.com/raw/gobluestingray/metricwise_odoo/pull/<PR Number>.diff /tmp/
RUN patch -d /usr/lib/python3/dist-packages/odoo -p1 </tmp/<PR Number>.diff
- For example, the Date Quick Links PR #1 was added as a patch to the Dockerfile as such:
ADD https://patch-diff.githubusercontent.com/raw/gobluestingray/metricwise_odoo/pull/1.diff /tmp/
RUN patch -d /usr/lib/python3/dist-packages/odoo -p1 </tmp/1.diff
-
Then, create a Pull Request into the upstream MetricWise/odoo-metricwise repo.
-
Additionally, once MetricWise/odoo PRs are approved, some MetricWise PRs will also be PR'd upstream into odoo/odoo. This will be done via the same method as above, creating a PR to upstream from the Pull Requests Tab.
- Submitting PRs upstream to odoo/odoo should not take up more than 20% of the task's time.
- To determine whether a task should be submitted upstream to odoo/odoo, we will be using our best judgement to deem if a feature or fix is good for the general community. Some tasks may have a note that it will/won't be submitted to odoo/odoo.
- MetricWise manages tasks through Jira. As of July 1st, three Blue Stingray members have limited access to MetricWise's Jira instance. MetricWise would like us to log the amount of hours spent on the task once the task is complete. If you do not have access to the Jira Instance, let a team member that does have access know to log the hours for the task in Jira. These will be taken from Odoo PM.
- Since MetricWise would like us to submit to odoo/odoo, we should try and follow their JS Coding Guidelines for any tasks requiring Javascript. These guidelines can be found here. We currently do not have a linter set up for JS.
- Since we are working on a fork, we need to keep our repository up-to-date with the MetricWise repository. To do this, we'll add a new remote repo to the repository.
git remote add upstream https://github.com/MetricWise/odoo.git
- Once you have added the remote, fetch from the remote.
git fetch upstream
- Make sure you are on the 15.0 branch
git checkout 15.0
- Rebase the changes from the remote
git rebase upstream/15.0
- If there are merge conflicts when rebasing, then the upstream repo has likely been rebased to a different
HEAD
position. In this case, we will perform a hard reset on theupstream
15.0
branch to ensure that our commit history is in sync with the upstream commit history
git reset --hard upstream/15.0
- Finally, force push to the 15.0 branch
git push -f origin 15.0
The 15.0 branch should now be up to date with MetricWise's 15.0 branch.
The odoo-metricwise Repo is set up a bit different than the metricwise_odoo repo. All changed core contents are added via patches present in the docker/odoo/patches directory. To begin using this repo, first clone it down to your local:
git clone [email protected]:gobluestingray/odoo-metricwise.git
Once you've cloned it, run this command to generate some of the necessary directories:
pushd odoo-metricwise && mkdir -p .git/hooks && ln -sf ../../hooks/pre-commit .git/hooks/pre-commit && popd
Then, initialize the git submodules
git submodule update --init
Once the submodules have been updated, update the Docker image by running:
./pull.sh
Once your docker image has been updated, to start up the containers for the first time, or to nuke everything and restart, run:
./run.sh -b
You should be able to access the Odoo server at localhost now.
To run tests, use the following command:
./test.sh -b