Latest commit. Git stats 3 commits 1 branch 0 tags. Failed to load latest commit information. View code.
By the end of the book, you will have a thorough knowledge of Odoo and will be able to build effective applications by applying Odoo development best practices Instructions and Navigation All of the code is organized into folders. The code will look like the following: from odoo import models, fields, api class LibraryBook models. Model : [ Adding a hierarchy to a Model.
Adding constraint validations to a Model. Adding computed fields to a Model. Exposing related fields stored in other Models. Adding dynamic relations using Reference fields. Adding features to a Model using inheritance.
Using abstract Models for reusable Model features. Using delegation inheritance to copy features to another Model. Defining model methods and using the API decorators. Reporting errors to the user. Obtaining an empty recordset for a different model. Creating new records. Updating values of recordset records. Searching for records.
Combining recordsets. Filtering recordsets. Traversing recordset relations. Extending the business logic defined in a Model. Extending write and create. Customizing how records are searched. Using external IDs and namespaces. Loading data using XML files. Using the noupdate and forcecreate flags. Loading data using CSV files. Loading data using YAML files. Addon updates and data migration. Producing server logs to help debug methods. Using the Odoo shell to interactively call methods.
Using the Python debugger to trace method execution. Pdfdrive:hope Give books away. Get books you want.
Pretty much any physical server these days is more than enough to handle an average sized Odoo instance with about 20 simultaneous users. Since virtual machines typically have fewer resources provisioned, you will need to pay a little more attention to this if you are planning to run on a VM. Here are a few key figures to get you started.
Obviously, they will need fine tuning to match your use of Odoo. Don't be shy on this; the last thing you want to happen is your server swapping. The source code of your instance will eat up 1 to 2 GB of hard disk if you are keeping the Git history, which we recommend in this recipe. Start with 5 GB, which should give you plenty of time before getting full, and monitor the disk usage. If you are running the database on the same host, give plenty of disk space to the partition that will contain the database working files, starting at 50 GB.
You will also need space for the on-site backups, both of the database and the file store. A lot can depend on your backup plan; GB is a good starting point. The default configuration of PostgreSQL is generally very conservative and is meant to prevent the database server from hogging all the system resources. On production servers, you can safely increase some parameters in the postgresql. Here are some settings for PostgreSQL 9. The pgtune utility can help in finding more suitable configuration.
Don't use two virtual machines running on the same physical server if you are getting down to this; use two physical servers with a high speed network connection between both. Source code version When cloning Odoo and the third-party dependencies, you may want to ensure that you are using the exact same revision as the one you had in developments.
You can do that and you will get started much faster because a lot of things are handled for you by the packages. However, there are a few issues with using the packaged source; most importantly, you cannot easily patch the source code of Odoo, which is easier if you run from the source.
Granted, this is not something you have to do every day, but being able to use the standard development tools to achieve this, rather than manually applying and tracking patches on production servers, is a precious help and a gain of time. You may also be using the Odoo Community Association branch of Odoo for which no packages are provided. Backups The recipe does not cover backups. At the very least, you should have the cron task on the server running a daily backup.
The backup files should not be stored on the same hard disk, and ideally, they would be mirrored on a server in a different physical location. Check these backups on a regular basis; having backups that you can't restore when you need them is useless. The proposed solution is to keep daily backups of the last 7 days, which means you will lose one day of work in case of a problem.
There are more advanced solutions available for PostgreSQL that allow point-in-time recovery. Similarly, there are many Linux tools, such as duplicity which you can use for file backups allowing easy management. We used the default values for lots of parameters, and if you've followed the Standardize your instance directory layout recipe in Chapter 2, Managing Odoo Server Instances, as well as the previous recipe for the production installation, you should now have that same configuration file in the production environment.
This recipe shows how to derive a configuration file that is suitable for use in production. Getting ready We assume that you have installed Odoo on the production server with the previous recipe, Install Odoo for production. You may want to install the pwgen utility to generate random passwords.
We are describing the steps here as if you were running them on the production server, but they can also be executed on your development server, since the new configuration file is added to the Git repository of the project that we use to deploy on the production server. To adapt the configuration file for production, you need to follow these steps: 1.
Edit the production configuration file production. Most of the parameters shown in this recipe are explained in the Manage Odoo server instances recipe in Chapter 1, Installing the Odoo Development Environment. In steps 3, 4, and 5, we change the addons path and the log file. In case you are developing in an environment with the same layout as the production environment, this is required because Odoo expects absolute paths in the configuration file.
Step 6 enables log rotation. This will cause Odoo to configure the logging module to archive the server logs on a daily basis, and to keep the old logs for 30 days. This is useful on production servers to avoid logs eventually consuming all the available disk space. Step 7 configures the logging level.
For more information on the log filtering, refer to Chapter 8, Debugging and Automated Testing, where you will find the recipe, Producing server logs to help debug methods. Feel free to tune this to your taste. Step 8 configures the database settings. This will work if you are running the PostgreSQL database server locally and have set it up as explained in the previous recipe.
If you're running PostgreSQL on a different server, you will need to replace the False values with the appropriate connection settings for your database instance. Step 9 restricts the database available to the instance by configuring a database filter. We also disable the database listing, which is not strictly necessary given that the regular expression we set in dbfilter can only match one single database. It is still a good thing to do though, in order to avoid displaying the list of databases to anyone, and to avoid users connecting to the wrong database.
The master password is used for database management through the user interface, and a few community addons also use it for extra security before performing actions that can lead to data loss. You really need to set this to a nontrivial value. We propose using the pwgen utility to generate a random password, but any other method is also valid. Step 11 configures Odoo to work with workers.
In this mode, Odoo will create a number of worker processes in this example, 4 to handle HTTP requests. This has several advantages over the default configuration in which the request handling is performed in separate threads, which are given as follows: Requests can be handled in parallel, making better use of multiple cores or CPUs on the server Python threads are penalized by the existence of the Global Interpreter Locks GIL in the Python interpreter.
It is possible to terminate one of the workers depending on resource consumption. This means the instance will not be reachable from other servers. This enables us to configure a reverse proxy on the same server to access the server and to force encrypted connections.
Take a look at the Configure a reverse proxy and SSL recipe later in this chapter. Try raising it a bit, as the default value is notoriously too low. If you have a reverse proxy, you may want to check its timeout limit too too low a limit in the reverse proxy will not prevent the transactions from completing, but will display an error message in the user's browser, which can cause them to retry the import and unnecessarily put some load on the server.
If your instance gets completely stuck when printing reports, try raising the number of workers. This can be a deadlock caused by wkhtmltopdf blocking up all the available workers while printing. In any case, always validate the setup before going to production, and remember to test printing reports when enabling workers.
Setting up Odoo as a system service For a production instance, it is very important that the Odoo server gets started when the computer reboots. On current Linux systems, this is achieved through a systemd configuration. If your OS is not using systemd, you will have to check the documentation to obtain this result. The scripts also makes use of the start-odoo script created in step 9 of the Install Odoo for production recipe. To configure systemd to start Odoo, you need to perform the following steps: 1.
As root, register the service: systemctl enable odoo. As root, start the service: service odoo start 4. To stop the service, you can run the following: service odoo stop [ 71 ]. Systemd uses some configuration files or scripts to know which programs must run when the server boots. The configurations provided in the recipe will need small adaptations to match the paths of your instance.
Don't forget to reboot your server and check that Odoo is properly started! Configuring a reverse proxy and SSL with nginx and Let's Encrypt In order to avoid all the information between the user's browsers and the Odoo server that is to be sent in clear over the network, it is necessary to use the HTTPS protocol that encrypts the exchanges.
Odoo cannot do this natively, and it is necessary to configure a reverse proxy that will handle the encryption and decryption on behalf of the Odoo server. This recipe shows how to use nginx for this.
Getting ready You should know the public name of the server and configure your DNS accordingly. In this recipe, we will use odoo. Make sure that port 80 and of the server are reachable from outside using the DNS name you will be using if you are getting the SSL certificate from Let's Encrypt. As root, install the Let's Encrypt client, certbot: apt-get install certbot 2. As root, install nginx: apt-get install nginx 4.
As root, restart your odoo instance and nginx: service odoo restart service nginx restart We are using nginx as a reverse HTTP proxy. You may need to adapt the port numbers to your configuration: The recipe sets up two files. The first one is the configuration for incoming connections on port 80 using the HTTP protocol.
We don't want these because they are in clear text, meaning that the passwords can be sniffed. These files are rarely updated, and so we ask nginx to cache them in order to lighten the load on the Odoo server. The certbot program is a command-line utility that eases interacting with letsencrypt. Use the -m option to specify your address. The --standalone option requests certbot to set up a local temporary web server which Let's Encrypt will attempt to contact to check that you do control the domain for which you are requesting a certificate.
It is therefore important that the command is run on the server which will be hosting Odoo, that the DNS is pointing to that server and that no firewall is blocking port 80 and on the server. By default, Let's Encrypt certificates have a validity of 90 days, which is quite short. Thanks to this utility, which we run on a daily basis, certificates which are about to expire are automatically renewed.
The aim of this module is to help you set up Let's Encrypt for your Odoo server. This recipe focuses on the nginx configuration. In this case, you can of course use these to achieve a similar setup. If you would rather not rely on Let's Encrypt and prefer using another Certification Authority CA , you can use the following process: 1.
The preceding command will ask you a series of questions about your company and your Odoo server's URL. Don't get these wrong or your certificate will be unusable. The CA will send you back a file called server. Finally, restart nginx See also For more information about the various nginx configuration options, see For a tutorial on the configuration of Apache2 as a reverse proxy and the use of a personal certification authority, take a look at [ 78 ].
This cries for automation, and maybe you have already written a shell script to download the proper version of the addons your instance needs and streamlined the process. It turns out that there is a tool meant to help with doing this called buildout. Buildout is a Python-based build system for creating, assembling, and deploying applications from multiple parts, some of which may be non-python-based.
It lets you create a buildout configuration and reproduce the same software later. This recipe shows how you can start using buildout to ensure you have the same setup in the development and production servers. At the time of writing this, the buildout recipe has not been adapted to work with Odoo This section is based on what is likely to be the correct way to use this tool, but you may encounter slight differences.
Be sure to check the documentation. We also expect you to have installed the build dependencies of Odoo. Refer to steps 1 to 3 of the Install Odoo for production recipe in this chapter. This recipe is better used first on a development machine and later deployed on a production server. In order to use buildout to build your project, you need to follow these steps: 1.
Create a file called buildout. Create a configuration file for the development environment in dev. Download the current version of the bootstrap. Run the bootstrap. Commit the files to Git you may also want to add a. Buildout works by processing a configuration file, which is called buildout.
This file uses a syntax close to ConfigParser with a few extensions to describe the desired target environment. There is one mandatory section, [buildout], which contains a parts entry listing the sections to process. Most sections have a recipe entry that gives the name of a buildout recipe to use to build the section. There are lots of recipes available take a look at for a partial listing , and different recipes can be combined in a single configuration file.
Each recipe supports its own configuration settings. Recipes are Python modules, usually made available from PyPI. Buildout configuration files are extensible and support parameterization: A configuration file can extend another one; configuration settings are added or overwritten by the extending file. In step 1, we prepare our base buildout. We define a section called [odoo] and set the anybox. Here are the settings we use: version: This defines the Odoo version we want.
Here, we are using the latest version from the 9. The depth options limit the Git clone depth to speed up the installation. The syntax is protocol URL destination revision options. The Git protocol will use Git to clone a repository. The local protocol will use a local directory and revision must not be provided in this case. Other available protocols are hg for mercurial repositories , svn subversion , bzr bazaar.
The revision can be a tag, a branch, or a commit identifier. It is important to fix the version of zc. The anybox. To generate this list, we copied the requirements. As we write this chapter, the adaptation of anybox. We are therefore unable to suggest a version number which will be compatible; you will need to check the documentation. The prod. In the [odoo] section, they both define settings with names starting with options.
Mind the dot : buildout will use these when generating a configuration file for the instance with the options set as specified in the configuration file. If you've read the recipe Adapting the configuration file for production in this chapter, the prod. In order to ensure that the buildout environment is insulated from the system Python, we use a virtualenv called sandbox in this recipe configured to not have setuptools available.
We use this virtualenv to run the bootstrap. The role of bootstrap. You can then manage your buildout configuration in a version management system such as Git. It is recommended that you store the bootstrap. If one addon module that you need requires an external Python dependency, you can add it to the [odoo] section using the eggs setting.
The buildout recipe supports this through the merges option. We use here the reference for pull requests provided by GitHub. The merged branches can evolve and be rebased or overwritten without notice. It is better that your deployment depends on non-merged PR so as to use a personal fork of the project on which you will do the merges yourself to ensure that you get repeatable builds. Also, note that the buildout freeze-to option, which is explained next, does not work with merges.
Freezing a buildout To ease deployment, it is possible to use some advanced commands. If the target server is running the same version of Linux as the server you are working on, you can deploy the production environment without compiling any dependency by performing the following steps: 1.
Copy that archive on the production server using a suitable procedure USB key or rsync, for instance. These containers can be used to ease the distribution of applications and their dependencies.
There is a whole ecosystem built around Docker, meant to ease the deployment and management of dockerized applications. Discussing the details is far beyond the scope of this recipe and the interested reader may want to check the book Learning Docker from Packt Publishing, for more in-depth explanations.
The E-mail Address es field is required. Please enter recipient e-mail address es. The E-mail Address es you entered is are not in a valid format. Please re-enter recipient e-mail address es.
You may send this item to up to five recipients. The name field is required. Please enter your name. The E-mail message field is required. Please enter the message. Please verify that you are not a robot. Backend Views Introduction Adding a menu item and window action How to do it See also Having an action open a specific view How to do it See also Adding buttons to forms How to do it Operators Pitfalls See also List views How to do it Search views How to do it Order of evaluation in view inheritance See also Document-style forms How to do it Dynamic form elements using attrs How to do it Embedded views How to do it Kanban views How to do it Showing kanban cards in columns according to their state Getting ready How to do it Calendar and gantt views How to do it Graph and pivot views Getting ready How to do it Access Security Creating security groups and assigning them to users Getting ready How to do it Adding security access to models Getting ready How to do it Limiting access to fields in models How to do it Limiting record access using record rules Getting ready How to do itGitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together. If nothing happens, download GitHub Desktop and try again. If nothing happens, download Xcode and try again. If nothing happens, download the GitHub extension for Visual Studio and try again. It contains all the supporting project files necessary to work through the book from start to finish. Odoo is a full-featured open source ERP with a focus on extensibility. The flexibility and sustainability of open source are also a key selling point of Odoo. It is built on a powerful framework for rapid application development, both for back-end applications and front-end websites. Version 11 offers better usability and speed: a new design as compared to odoo 11 development cookbook pdf free download current Odoo Enterprise version and a mobile interface. The book starts by covering Odoo installation and administration and Odoo Server deployment. It then delves into the implementation of Odoo modules, the different inheritance models available in Odoo. You will odoo 11 development cookbook pdf free download learn how to odoo 11 development cookbook pdf free download access rules 2pac this life i lead download mp3 free your data; how to make your application available in different languages; how to expose your data models to end users on the back end and on the front end; and clokbook to create beautiful PDF versions of your data. By cookgook end devrlopment the book, you will have a thorough knowledge of Odoo and will be able to build effective applications by applying Odoo development best practices. All of the code is organized into folders. Each folder starts with odoo 11 development cookbook pdf free download number followed by the application name. For example, Chapter If you are running another distribution, things should be fairly straightforward; the main differences should be in odoo 11 development cookbook pdf free download names of the packages to install, and possibly the location of the configuration files of PostgreSQL and Nginx. This is a frequently asked question by newcomers. The best answer is odoo 11 development cookbook pdf free download use whatever tool you are familiar with. Personalized experience. Get started with a FREE account. Preview Download. “ Life isn't about getting and having, it's about giving and being. ” ― Kevin Kruse Working with Odoo Configure, Manage, and Customize Your Odoo System Cookbook Web Development with Django - Step by Step Guide Beau Curtin. [Download] PDF Odoo 11 Development Cookbook - Second Edition: Over unique recipes to build effective enterprise and business applications, 2nd. PDF DOWNLOAD Odoo 11 Development Cookbook - Second Edition: Over unique recipes to build effective enterprise and business applications *Full. Read "Odoo 11 Development Cookbook - Second Edition Over unique recipes to build effective enterprise and business applications, 2nd Edition" by. Explore a preview version of Odoo 11 Development Cookbook - Second Edition right now. Start your free trial Get the most up-to-date guide on Odoo 11 to create custom and reusable modules on the back end and on the front end; and how to create beautiful PDF versions of your data. Download Example Code. Odoo 11 Development Coobook, Second Edition, published by Packt This is the code repository for Odoo 11 Development Cookbook - Second Edition, back end and on the front end; and how to create beautiful PDF versions of your data. by Holger Brunn, Alexandre Fayolle [PDF EBOOK EPUB KINDLE] DOWNLOAD PDF Ebook Textbook Odoo 11 Development Cookbook - Second Edition. Odoo 11 Development Cookbook - Second Edition the back end and on the front end; and how to create beautiful PDF versions of your data. Odoo 11 Development Cookbook: Over unique recipes to build effective Edition/Format: eBook: Document: English: 2nd edView all editions and formats Git configuration; Downloading the Odoo source code; Starting the instance;. Download from UsersCloud. You will then learn how to define access rules for your data; how to make your application available in different languages; how to expose your data models to end users on the back end and on the front end; and how to create beautiful PDF versions of your data. This site comply with DMCA digital copyright. We do not store files not owned by us, or without the permission of the owner. You may check www. You will then learn how to define access rules for your data; how to make your application available in different languages; how to expose your data models to end users on the back end and on the front end; and how to create beautiful PDF versions of your data. Version 11 offers better usability and speed: a new design as compared to the current Odoo Enterprise version and a mobile interface. After that, you'll learn how to work with Odoo for mobile, and finally, you will walk through the recent Odoo 11 features with respect to the community and enterprise edition, giving you a complete understanding of what Odoo can do for your business. What you will learn Configure a functioning customer relationship management system Set up a purchasing and receiving system Implement manufacturing operations and processes using real-world examples Discover the capabilities of Odoo's financial accounting and reporting features Integrate powerful human resource applications Utilize Odoo's project management application to organize tasks Customize Odoo without writing a line of code Who this book is for This book is for beginners, and will help you learn advanced-level features with Odoo such as creating your own custom modules. Ermin Trevisan.