There is not much to say about the IDE, you should choose one you are familiar with and you feel comfortable with for developing in python, xml, css and js. Even though in the Acustmata level you just need a tool for python and xml files, in further levels we will work with other languages too. If you dare to code in Notepad, well, let me tell you that it is time to resign barbarian manners and get civilized. Later on, we will use source code repositories and we will look for examples in the Odoo source code, so it is essential to work with a good tool. Conclusion We will not recommend any IDE, because you are clever enough to choose one that matches with the required features.
Working enviroment for Odoo
Acusmatas, sharpen your senses because we are about to show you the cornerstone of construction in ODOO. If you really wish someday to reach the Odoo Mathematical level, it is crucial for you to be organized, precise and tidy since your start in this Order. Trust this old man, working environments and source code organization are important in any kind of development per se, but they are much more important when working with Odoo, because its paradigm demands an appropriate file structure, which if it is not met, will give you big headaches, even more if you cannot see the log files and find out what is going on. For all this, to learn and develop, we recommend the intensive use of Docker technology, later on you will see why we recommend it, for now just have some faith. Hereinafter I am going to explain what a basic working environment is for us, Odoo Pythagoreans. Let’s start * Axiom: proposition or statement so evident that does not need demonstration. “I will develop with IDE, will log with Docker and synchronize with Filezilla” should be like a mantra for you in the acusmata degree. The IDE I am not going to teach […]
Source code repository
Once again, I tell you that it is not part of the pythagorean study map to teach you how to use a source code repository, this should be something very well known to you. We are focused on showing you our development experience to pave the way to the Odoo light, for that reason I will briefly show you why I use a source code repository. There are three main reasons why it is important to understand how a source code repository works: For now, first and second reasons should attract your attention. I recommend you to read official GIT docs and try to understand what are commits, push and pull. Best practices By doing this, your source code will be organized and safe, and you will be able to rollback and improve your code if you realize it has errors.
One of the best Odoo features is its modularity. This makes it flexible and easy to read, but on the other hand you must be organized and foresighted when developing solutions. By modularity, I mean that in order to provide a solution, you have to decide between install an Odoo base module, or else develop new modules. Do not reinvent the wheel Odoo has many modules already developed, most of them are free under their respective licenses, others are paid. That is why I say we must be organized and foresighted, because if we do not know Odoo base modules, we are likely to start developing something that already exists and might just need to be adapted (you will need time, but it is the cost of the oportunity). If you are not foresighted, you will develop a “super module” that has thousands of features, and three days later you will realize that you need one of those features in other module, but not all the others. You might avoid this every time you analize the problem noticing that you can encapsulate in one module that simple feature. Then you just have to inherit that module in your future modules (very similar […]
Model – view – controller (MVC) notion
This time, I would like to review with you the Model – View – Controller (MVC) design pattern, because it will be very helpfull to understand Odoo modules development. This will be the last boring topic, then we will be fully focused in Odoo itself… The MVC design pattern aims to separate data, logic and user interface (UI). You might be young developers and are used to program in high-level languages or Object-oriented programming languages so, almost without realizing you are using MVC design pattern in your developments. I suggest you do the mental gymnastics to imagine a software with three different levels, a model level, where all data is structured, for example a DB engine that stores, updates and deletes data, a controller level, which has certain logic responding to events, and based on them it gets in touch with the model to interact with data and a view level, where the user can easily see all the information and has some elements to generate events that at the same time are linked to the controller, and this in turn with the model. This way, depending on user preferences, we could change the view and adapt it to his needs, but model […]
Metadata, manifest file
The manifest file, on earlier Odoo versions was named __openerp__.py, but since version 9, word “openerp” was deleted from everywhere. Particularly, I think now it has a really appropriate name, because this file is like the contuctor of the orchestra, it has the baton and decides who gets up and who does not. Now let me show you the file parameters, and then we will see an example of how to declare it. name Module name. version Module version. summary Module short description. description Module larger description. category Module category. See full list here: Customer Relationship Management Sales Management Project Management Knowledge Management Warehouse Management Manufacturing Invoicing & Payments Accounting & Finance Purchase Management Human Resources Extra Tools Marketing Point of Sale Advanced Reporting author Your name, company name and your degree in the order. website Your website. license The license you wish to apply to your source. Default is AGPL-3. depends List of (modules) dependencies of your module. data xml and csv files that will be loaded (these files may contain views, security configuration files, etc). demo Additional xml files used to load demonstration data to test your module. installable True or False. Defines if this module is installable, as it could a module […]
I can see some of you reached this point and others were left behind, I advised you before beggining, it is a long and painful way with no shortcuts. I know that you are experienced developers and that you are here cause you are curious, I know that I can not teach you anything about client-server model, even so, I am going to insist in reviewing this subject, because I will always be Acusmata, and perseverance is what should characterize every Acusmata. Why are we interested in this model? Because Odoo is a web based system, there is a server and many clients requesting for its “services”. I intend to make this scheme clear, just cause (as we have seen before) we will work with VMs with their own IP and docker containers that will have their ports numbers assigned, and if we do not understand the difference between a client and a server, it will be very difficult to go forward. Every Odoo installation we do regardless of whether it is on a physical computer, a virtual machine or on Docker (might be at the same time inside a VM), has an IP address plus a port number (might be 80) […]
Odoo module structure
Gentlemen, the day when you will test all your knowledge is coming, what does not come out in practice, does not come out during the game, so keep working hard, do not decay now. Module structure As the official docs say, an Odoo module consists of the following elements: Odoo suggests a group of best practices and guidelines to develop a module, that tell us among other things, how we should name our files. I will to show you a basic file structure example that we use to develop an Odoo module. It is the same structure that Odoo uses for its own modules. We will explain what each folder and file of this simple initial structure is for (even though their names are pretty suggestive). No more contributions in this regard, this is the basic structure, then with more experience, we will be able to modify or expand this structure, but by now let´s go forward slowly and steady. Cheers!
Odoo itself: views, models, menus and actions
You feel that noise? Oh yeah! it is drops of water falling. Here, we just teached you the way to the slope, and you are reaching it by using all your senses. We are almost there Acusmatas, almost there… I wish to believe that if you are here is because you read the MVC post before (I will be disappointed if you do not know what those initials mean). Well, none of the subjects included on the study plan were introduced by caprice, that study plan is a Pythagoras’ legacy for us, his disciples, and his last words were… Ok, it is true, I can not tell you his last words because you are yet Acusmatas and you will be confused… let’s proceed. Let’s begin There are four basic concepts vastly used in Odoo development: Views, Menus, Actions and Models. Do not get early conclusions, do not try to make a direct relationship between Odoo paradigm and MVC design pattern. Odoo has a high-level framework (we can do great things with little code), so I am going to explain each of these concepts and how they are related to MVC design pattern. A model It is the declaration of an […]
Well, the D-day has come. Gentlemen, today you must remember the sweat and tears left on the road, because you need to draw the necessary strength to face The Test, and where will you draw that strength if it is not from the memory of the great effort you have made to get here. Remember the word “Acusmata”, if you forget it, you will be lost, and not all of us know Ariadna to give us a thread to find the way back home. Let’s begin First step: have a problem to solve We are going to develop a module to manage the Odoo Pythagorical Order disciples. Let´s start with a simple class diagram and as we advance in the degrees, we will make the challenge more complex, so that we can learn new things. In this example, we have three classes, one of them is the most important, it is you, the disciples of this respectable Order. That class has a “Many to one” relationship with Degree class, and a “Many to many” relationship with “CommunityHelp” class. So, if we could take a picture of the system, we could say: A disciple can just be related to one degree, […]
Acusmatas, we are very close to pass to the next degree. In the next one, difficulties grow exponentially, but if you have learnt the best practices, it will be very easy, there are no imposible difficulties for virtuous men. SQL constraints We will now see an SQL constraint, and in the next level I will show you what Odoo calls constrains. If we analyze the previous example: it is clear that we should not have two Degrees with the same name. So well, let´s tell Odoo to put a unique constraint to the attribute name of the Degree model. Edit models/degree.py and add the following lines. As you can see, we are overwriting the _sql_constraints attribute of the Odoo Model class. Now, when you try to save two degrees with the same name, Odoo will raise an alert messagge: Consider that each _sql_constraints, has three parameters with the following format: (constraint_name, constraint_function, alert_messagge) You can find out more about Postgresql SQL constrains here. I suggest you to test other kind of constraints, not just UNIQUE, and that you also try to use constraints on more than one attribute. The end We have reached the end of this trip. As you can see, there were much more […]