Hello and welcome to this developer talk named “Best Tools for First-Time Odoo Development”, my name is Yannick Tivisse and today I’m here to talk about a little crash course to give you some tips and trick on setting-up your dev environment.
say for example, and I know that you we've all been there, you just want to start working with a new framework you think “oh that's a I'd like to learn how to do more technical things how to do customizations with it and we always have a whole load of questions the first time we start working with a new framework.
we'll go over some prerequisites and know where to find the documentation.
we'll talk about using the proper IDE
we’ll talk about using git on odoo.sh there are a few specificities that you need to
Know
and we'll do a lightning round with all the tools and we'll end the this talks with a Q&A session
So, first prerequisites and documentation.
Let's put ourselves in the scenario.
You just downloaded the Odoo source code from github.
You've gone through the deployment procedure.
I mean, the odoo documentation also comes with a full deployment procedure so you just need to follow that and everything is in this documentation you can really go from the very first point of this documentation and you'll have your entire code ready with a running local instance.
You've got it. You installed the needed libraries, and you launched a server using the binary file. It's running correctly and you are ready to start.
Right… Where is the doc ?
that's always the first question.
there are several sources for you to find a documentation the first one is
the official documentation odoo.com/documentation. You'll find
plenty of references there on how to set up your models, how to take care of the
front end, how to set up your views, etc…, etc...
You can also look at more technical odoo experience talks, well, just like
this one.they are all available on the website and on the official odoo
YouTube channel so you can rewatch them later and as many times as you want
The Odoo code itself. Once you're familiar with the framework you'll find that the standard odoo code is a great source of inspiration for your own code that is as
soon as you're familiar with it.
and of course the Git commit messages. The R&D team has a nice policy in place to always always write meaningful Git messages, so be sure to read them. You can
git blamed to find why a line of code was written and what its use is specifically.
Now, Choosing your IDE. That's always a question. what's the best tool for the
job ? what should I use ? Does Odoo recommend an IDE in particular ? what
should I be looking for ?
maybe you can forget about always use the right tool
for the job
use the right tool for yourself.
we don't necessarily recommend one IDE or another. One of the strengths of Odoo
is you can do mostly everything from the command line really. Some
people like to completely use the terminal use the pipe grep and everything.
But if you really want to choose an IDE, here are the things you should be looking for: Do you want integrated debugging capabilities? do you want to built-in git integration? do you want an easy code lookup? do you want syntax highlighting? and more and more. For example, I like an IDE with a nice good-looking UI, a syntax highlighting, a nice way to navigate between files, and that’s all. No debugging capabilities as I prefer to do it by hand, and absolutely no git integration, as I want to execute my commands myself too.
For you, it all depends on how you want it implemented and if you really do want it in your IDE.
If you still have trouble choosing, here are four that I would recommend as we use them internally. You have atom, Sublime text, Visual Studio code, or pycharm. Personally, I use sublime-text with 3 plugins, a tool to blame files, a linter for python code, and a linter for js code.
I can guarantee you that these will be fine for the job as, again, we use them internally in the professional service technical team or in the different R&D teams in Belgium.
But next let's talk about git.
Good news: you don't have to worry about a thing, mostly.
Bad news: you do have to worry about a few things.
When working with odoo.sh there are a few caveats you should be aware of.
Concerning odoo.sh, in case you don’t know the principle, you push your commit to your online repository and a web hook triggers an update of the code
on odoo.sh.
First of all pay attention to your modules version number.
First of all pay attention to your modules version number.
It's in the manifest. it's that little number right here.
Increasing the version number is what is going to let odoo.sh know that you should update the data in your module.
Everything that's in data, all your CSV, all your XML, if you forget to bump the version number odoo.sh is not going to set that up to date which means all your views or your security rules, all these changes will be discarded so never forget about the version number.
of course there's an exception to this: the no update attribute. When you declare a
record in Odoo you can set up a no update attribute.
If it's set to true, then no matter what you do it will not be updated. That way, you let the possibility to the user to modify the record configuration, without loosing its modifications on a module update.
Next point is the odoo.sh merge tool. Now we have to talk about it even though it's in odoo.sh and it's a function that is available to you. I would highly recommend that you do not use the drag-and-drop merge tool on Odoo.sh. it's mostly there
for the same reason that there's a Juniper editor on it. It's more for prototyping purposes if you're working from a workstation I would strongly suggest that you merge and rebase on your workstation and then push the changes. Otherwise you're just going to make a confusing git repository. That for the same reason that I don’t use a tool on my IDE to automatically commit or pull my branches. The git history is always a disaster afterward.
And finally many people forget about it but if you're working in a big team it's always a good idea to have a git tree visualizer. I personally use tig, which is very minimalist in its interface and complex enough. I know git ke and git Kraken are also very popular, you can use these one the idea is just to have a visual reference of
The changes that have been made from your team on your repository. It really helps keep things clean.
All right now the other tools. We're doing just a quick fly around here because all of this has been mentioned in other talks. Again odoo.com on YouTube. You can go on it and check these.
The browser tools.
The tagline for this one is press f12 or CTRL + SHIFT + J on your keyboard and discover a load of debugging capabilities. you can check the HTTP
calls made to the back end. You can debug your front-end code but more on that has been addressed in another talk.
You can also use pyflame in combination with framegraph. This tool is particularly
useful if you want to debug, in the case of a performance issue. Say for example there is a function that is using all your CPU and you'd like to know what exactly that function is. You can have a recording of your stack trace.
Locust is used for load testing. Very useful for example in website applications if you
expect a high attendance and we have some extra tools like the high data import and export tools.
And finally the best for last this one is going to change your life trust me,
the scaffold command. Many people read about it in documentation and forget
about it. This command creates a bare bone project, all the skeleton is there with the manifest, the init files in the right place, all your sub directories to organize your code and you just need to fill it in.
This command will save you a lot of time.
Thank you for attending, and don’t forget that all the slides of the presentation will be uploaded to our website.
If we still have some time, I’m here to answer your questions.