Versioning in Odoo - migration

I am working on custom addons in Odoo. I have release versions in project. I need hooks, but I need them almost for every release. It will be great to have history of those hooks in code, so I thought about migrations in Odoo. I made migrations directory in my custom addon, I created there directory with release version and there I created some pre-hook.py and post-hook.py with migrate function. I thought that if I will pass to __manifest__.py version number then migration hooks will work. I did it and nothing happened. Do You know how to handle versioning in Odoo?

Related

Managing feature branch versions with npm for component packages

We have a React App which uses some components written by us and published to our internal npm repository. Our code is maintained in Bitbucket Data Center, the build is done with Bamboo and the npm repository is hosted in JFrog Artifactory. We work with feature branches and pull requests for developing new features.
It happens often that a new feature in the app, requires a change in the component. In this case, each repository (the App and the component) will have its own feature branch and pull request. Many times the component interface changes, so that the App needs the pull request version of the component and not the mainline one to build and to be tested.
The build is done exclusively by the build server, so that the bundled javascript files are not committed to git.
Let's say the component has version 1.0.0. A new feature in the App needs a change in the component. In this case, the component version will incremented to 1.0.1. We don't want to publish it to Artifactory, until version 1.0.1 is tested, but at the same time, the build of the new App version needs the changes from version 1.0.1.
Our current solution is to change the package version of the component during the build of feature branches to something like 0.<Ticket #>.<Build #>. This 0.x.x version will be published to Artifactory so that the App feature branch can use it to compile.
We use 0.x.x so that the version is never bigger than the current released version. Once the component is merged to the main branch, it will compile with the right version (1.0.1) and will be published to Artifactory again.
I find this solution cumbersome, it requires some funny build scripts, making sure that the branch name always follows some convention and teaching developers about it.
I wonder if there is a better way for managing pull requests and feature branches using npm, without having to manipulate the package.json during build time, depending if it is a feature branch or the main branch.
Sounds like you are using artifactory like a secondary version / staging for the npm package, just use npm?
I am not in devops, but have worked on a few packages, testing a package that has not been released does not sound like testing the package - what about using a beta tag npm publish --tag beta, pulling that into your app npm i package#beta then testing your application in a staging environment?
As i expect you know if you apply a tag then the tag would need to be specified to be pulled into a repo so you can use it to deter users from using that version of the package - an i believe you can delete versions later if you are dead set on not having it public.
Here is a medium article which may be helpful?

Which is the best way to work with 3rd party repositories in Odoo.sh?

I got an Odoo 15 Enterprise running with the Odoo.sh platform.
When I add an OCA repository, I add it with the Submodule option, and this generates a OCA directory inside src/user. Which is the best way to update that code? If I go to src/user/OCA/repository-name, would doing a git pull there be ok?
Can anyone share their method? There is documentation on how to create your own modules, but not much about adding external repos and keep them updated.

How can I use a fork of react-admin (or one of its packages) in my production environment?

I need a few changes to the ra-core package of the react-admin monorepo on my productive environment.
Can I tell a lerna published module to use my own published module as a submodule instead of it's own?
It's about this package:
https://github.com/marmelab/react-admin
https://www.npmjs.com/package/react-admin
I'm about to create a PR to maybe have these changes merged into the project itself, but I can't know when it will be merged and / or whether it will be even accepted.
But unfortunately I need these changes immediately and it's okay for me to use a fork of mine until it's clear what happens to the PR.
I tried to fork a new ra-core package and use this in my package.json, but this doesn't work. Locally linking is no problem, as I can link it directly in the react-admin module, but I need it in my production build process.
So I'm wondering if there is some way to tell the module in my package.json (react-admin) which comes with it's own subpackages to use one package that I provide in the package.json instead of it's subpackage.

React native update template

I started my project with a template:
react-native init myApp --templateez-devs
The template has upgraded and I would like to know if there is a way to upgrade my project without be manually.
tl;dr
In a word, no. You'll have to do it manually.
Templates
The templating system is quite dumb it basically creates a new react-native project and then copies the files that are included in the template and then installs the dependencies that have been listed.
As you will undoubtably updated files that were included in the original template, you wouldn't want to just install it over your existing project and hope for the best. That would cause you lots of problems. You may also have installed dependencies that require linking with native code, the template wouldn't specifically know about these changes.
Ways to upgrade
So how can you update to the new template? Well it really depends on what you have done to the project. Unfortunately there is not going to be an easy way to do it.
To see what the major changes are between the templates I would look at the files included in the release that you are currently using, and the release that you plan to use and create a diff this can be done using the following command
diff -ur b a > ba.diff
where a and b are the directories that you are comparing.
Unfortunately the template that you are using doesn't create releases on their github https://github.com/maykonmichel/react-native-template-ez-devs/releases
You could attempt to download them off of their npm page https://www.npmjs.com/package/react-native-template-ez-devs .
Ultimately you can compare the changes on their github by looking at the commit history, you could look at the changelog if it existed, you can also look at the dependency versions that they are using and see if they have differed from the ones that you have used.
You can use github to do your compare
Here is an example of the comparison between the most recent commit and one from a few days before.
https://github.com/maykonmichel/react-native-template-ez-devs/compare/f4ffa06..04a1b8c

Is it possible to integrate Webpack/VueJS with the Odoo Framework (v12)?

I'd like to integrate VueJS through WebPack in one of my custom Odoo modules, and have it start up automatically when I launch Odoo-bin.
Does anyone have a solution?
Is it even possible?
I know you can include VueJS as a simple .JS file in the module's template, but that means I can't use the .vue components supported by WebPack.
I also read that Odoo has its own JS framework, but I couldn't find good tutorials/documentation for it.
EDIT: To anyone that might be wondering how I solved this, here's what I did:
I initialized a package.json file in the root of my Odoo folder using npm init. I added a start script to the package that launches webpack and bundles all vue components in myAddons folder (where I store my custom modules), then launches Odoo through the python odoo-bin ... command. All that's left is to use npm start to start it all up.
This way, the vue components get bundled into single JS files, that I then add to the templates of my modules. This has a small inconvenient in that the first bundle has to be done manually in order to know which JS files need to be imported to the templates. Also, i'm still trying to figure out how to bundle the components of every single module separately. Will update this once I find a proper way to do it. ...Hopefully.
By default, odoo frontend part is heavily built upon backbone, jquery, underscore. If you want to use any other JS library, you have to make sure the compatibility in between them. The odoo backend parts of JS functionalities are written under web module can be found in odoo/addons/web/static/src/js directory in odoo community codes. The ecommerce/website part is under website* modules.
Along with the fact that the Odoo JS API documentation is basically non-existent (as of the time I am posting this) .. I would add the fact that its going to be like working with a moving target compared to calling Odoo's JSON-RPC API directly since their JSON-RPC API changes very little over different versions of Odoo.
Moreover, making JSON-RPC API calls with Axios is extremely simple. So just go directly to the server's JSON-RPC API from your Vue project.
This is what I am doing with at odooinvue.org which is basically a Vue project that uses Odoo in the back-end. That project is designed specifically as a resource for Vue developers that are trying to use Odoo in the back-end but have difficulty because they are new to Odoo development.
I suggest trying #StartupGuy's odooinvue, which is really nice.
With Odoo 14 they created a new modern frontend framework: Owl framework.
I have not tried it myself.