Title Page Copyright and Credits Odoo 12 Development Cookbook Third Edition About Packt Why subscribe? Packt.com Contributors About the author Previous edition authors About the reviewers Packt is searching for authors like you Preface Who this book is for What this book covers To get the most out of this book Download the example code files Download the color images Code in Action Conventions used Sections Getting ready How to do it… How it works… There's more… See also Get in touch Reviews Installing the Odoo Development Environment Introduction Odoo ecosystem Odoo editions Git repositories Runbot Odoo app store Odoo community association Official Odoo help forum Easy installation of Odoo from a source Getting ready How to do it... How it works... Virtual environments PostgreSQL configuration Git configuration Downloading the Odoo source code Starting the instance Managing Odoo environments using the start command Getting ready How to do it... How it works... There's more… Managing Odoo server databases Getting ready How to do it... Accessing the database management interface Setting or changing the master password Creating a new database Duplicating a database Removing a database Backing up a database Restoring a database backup How it works... There's more... Storing the instance configuration in a file How to do it... How it works... Activating the Odoo developer tools How to do it... How it works... Updating Odoo from source Getting ready How to do it... How it works... Managing Odoo Server Instances Introduction Configuring the add-ons path Getting ready How to do it… How it works… There's more… Updating the add-on modules list Getting ready How to do it… How it works… Standardizing your instance directory layout How to do it… How it works… See also There's more... Installing and upgrading local add-on modules Getting ready How to do it… From the web interface From the command line How it works… Add-on installation Add-on update There's more… Installing add-on modules from GitHub Getting ready How to do it… How it works… There's more… Applying changes to add-ons Getting ready How to do it… How it works… See also Applying and trying proposed pull requests Getting ready How to do it… How it works… There's more… Server Deployment Introduction Installing Odoo for production use Getting ready How to do it... How it works... There's more... Server dimensioning PostgreSQL tuning Source code version Backups Adapting the configuration file for production Getting ready How to do it... How it works... There's more... Setting up Odoo as a system service Getting ready How to do it... How it works... Configuring a reverse proxy and SSL with nginx and Let's Encrypt Getting ready How to do it... How it works... There's more... See also Using Docker to run Odoo Getting ready How to do it… How it works… Running the Odoo image with a configuration file Running the Odoo image with custom add-ons Running multiple Odoo instances There is more... Running Odoo through docker-compose Getting ready How to do it... How it works... There's more... Managing content delivery networks for websites Getting ready How to do it... Configuring the CDN provider Configuring CDN at Odoo How it works... There's more... Creating Odoo Add-On Modules Technical requirements Introduction What is an Odoo add-on module? Creating and installing a new add-on module Getting ready How to do it... How it works... Completing the add-on module manifest Getting ready How to do it... How it works... There's more… Organizing the add-on module file structure Getting ready How to do it... How it works... Adding models Getting ready How to do it... How it works... Adding menu items and views Getting ready How to do it... Accessing Odoo as a superuser How it works... Adding access security Getting ready How to do it... How it works… See also Using the scaffold command to create a module Getting ready How to do it... How it works... Application Models Introduction Technical requirements Defining the model representation and order Getting ready How to do it... How it works... There's more... Adding data fields to a model Getting ready How to do it... How it works... There's more... Using a float field with configurable precision Getting ready How to do it... How it works... Adding a monetary field to a model Getting ready How to do it... How it works... Adding relational fields to a model Getting ready How to do it... How it works... There's more... Adding a hierarchy to a model Getting ready How to do it... How it works... There's more... Adding constraint validations to a model Getting ready How to do it... How it works... There's more... Adding computed fields to a model Getting ready How to do it... How it works... Exposing related fields stored in other models Getting ready How to do it... How it works... There's more... Adding dynamic relations using reference fields Getting ready How to do it... How it works... Adding features to a model using inheritance Getting ready How to do it... How it works... There's more... Using abstract models for reusable model features Getting ready How to do it... How it works... There's more... Using delegation inheritance to copy features to another model Getting ready How to do it... How it works... There's more... Basic Server-Side Development Introduction Technical requirements Defining model methods and using the API decorators Getting ready How to do it... How it works... There's more... Reporting errors to the user Getting ready How to do it... How it works... There's more... Obtaining an empty recordset for a different model Getting ready How to do it... How it works... See also Creating new records Getting ready How to do it... How it works... There's more… Updating values of recordset records Getting ready How to do it... How it works... There's more... Searching for records Getting ready How to do it... How it works... There's more... Combining recordsets Getting ready How to do it... How it works... Filtering recordsets Getting ready How to do it... How it works... There's more... Traversing recordset relations Getting ready How to do it... How it works... There's more... See also Sorting recordsets Getting ready How to do it... How it works... There's more... Extending the business logic defined in a model Getting ready How to do it... How it works... There's more... Extending write() and create() Getting ready How to do it... How it works... There's more... Customizing how records are searched Getting ready How to do it... How it works... There's more... See also Fetching data in groups with read_group() Getting ready How to do it... How it works... Module Data Introduction Technical requirements Using external IDs and namespaces How to do it... How it works... There's more... See also Loading data using XML files How to do it... How it works... There's more... Using the noupdate and forcecreate flags How to do it... How it works... There's more... See also Loading data using CSV files How to do it... How it works... There's more... Add-on updates and data migration How to do it... How it works... There's more... See also Deleting records from XML files Getting ready How to do it... How it works... Invoking functions from XML files How to do it... How it works... There's more... Debugging Introduction The auto-reload and --dev options Getting ready How to do it... How it works... Producing server logs to help debug methods Getting ready How to do it... How it works... There's more... Using the Odoo shell to interactively call methods Getting ready How to do it... How it works... There's more... Using the Python debugger to trace method execution Getting ready How to do it... How it works... There's more... See also Using the Odoo Community Association maintainer quality tools Getting ready How to do it... How it works... There's more... Using Pylint to check your code Using Flake8 to check your code Understanding the debug mode options How to do it... How it works... Advanced Server-Side Development Techniques Introduction Technical requirements Changing the user that performs an action Getting ready How to do it... How it works... There's more... See also Calling a method with a modified context Getting ready How to do it... How it works... There's more... See also Executing raw SQL queries Getting ready How to do it... How it works... There's more... See also Writing a wizard to guide the user Getting ready How to do it... How it works... There's more... Using the context to compute default values Wizards and code reuse Redirecting the user Defining onchange methods Getting ready How to do it... How it works... There's more... Calling onchange methods on the server side Getting ready How to do it... How it works... There's more... See also Defining a model based on an SQL view Getting ready How to do it... How it works... There's more... Adding custom settings options Getting ready How to do it... How it works... There's more... Implementing init hooks Getting ready How to do it... How it works... Backend Views Introduction Technical requirements Adding a menu item and window action How to do it... How it works... There's more... See also Having an action open a specific view How to do it... How it works... ir.actions.act_window.view There's more... Adding content and widgets to a form view How to do it... How it works... Form Header Button Group Field Notebook and page General attributes Other tags There's more... See also Adding buttons to forms How to do it... How it works... There's more... Passing parameters to forms and actions – Context Getting ready How to do it... How it works... There's more... See also Defining filters on record lists – Domain How to do it... How it works... There's more... Operators Pitfalls of searching using domains See also Defining list views How to do it... How it works... There's more... Defining search views How to do it... How it works... There's more... See also Changing existing views – view inheritance How to do it... How it works... There's more... Order of evaluation in view inheritance See also Defining document-style forms How to do it... How it works... Dynamic form elements using attrs How to do it... How it works... There's more... Defining embedded views How to do it... How it works... There's more... Displaying attachments on the side of the form view How to do it... How it works... There's more... Defining kanban views How to do it... How it works... There's more... Showing kanban cards in columns according to their state Getting ready How to do it... How it works... There's more... Defining calendar and gantt views How to do it... How it works... There's more... Gantt View Defining graph and pivot views Getting ready How to do it... How it works... There's more... Defining the cohort view Getting ready How to do it... How it works... Defining the dashboard view Getting ready How to do it... How it works... There's more.... Access Security Technical requirements Creating security groups and assigning them to users Getting ready How to do it... How it works... There's more... Adding security access to models Getting ready How to do it... How it works... There's more... Limiting access to fields in models How to do it... How it works... There's more... Limiting record access using record rules How to do it... How it works... There's more... Using security groups to activate features Getting ready How to do it... How it works... There's more... Accessing recordsets as a superuser How to do it... How it works... There's more... Hiding view elements and menus based on groups Getting ready How to do it... How it works... Internationalization Installing a language and configuring user preferences Getting ready How to do it... How it works... There's more... Configuring language-related settings Getting ready How to do it... How it works... There's more... Translating texts through the web client user interface Getting ready How to do it... How it works... There's more... Exporting translation strings to a file Getting ready How to do it... How it works... There's more... Using gettext tools to make translations easier How to do it... How it works... There's more... Importing translation files into Odoo Getting ready How to do it... How it works... Automation, Workflows, and Printouts Introduction Technical requirements Managing dynamic record stages Getting ready How to do it... How it works... There's more... Managing kanban stages Getting started How to do it... How it works... There's more... Adding a quick create form in a kanban card Getting started How to do it... How it works... Creating interactive kanban cards Getting started How to do it... How it works... Adding a progress bar in kanban views Getting started How to do it... How it works... Creating server actions Getting ready How to do it... How it works... There's more... Using Python code server actions Getting ready How to do it... How it works... There's more... Using automated actions on time conditions Getting ready How to do it... How it works... There's more... Using automated actions on event conditions Getting ready How to do it... How it works... There's more... Creating QWeb-based PDF reports Getting ready How to do it... How it works... There's more... Web Server Development Introduction Technical requirements Making a path accessible from the network Getting ready How to do it... How it works... odoo.http.route Return values odoo.http.request There's more... See also Restricting access to web accessible paths Getting ready How to do it... How it works... There's more... Consuming parameters passed to your handlers How to do it... How it works... There's more... See also Modifying an existing handler Getting ready How to do it... How it works… There's more... See also CMS Website Development Introduction Managing static assets What are asset bundles and different assets in Odoo? Custom assets How to do it... How it works... There's more... Extending CSS and JavaScript for the website Getting ready How to do it... How it works... Creating or modifying templates – QWeb Getting ready How to do it... How it works... Loops Dynamic attributes Fields Conditionals Setting variables Subtemplates Inline editing There's more... See also Managing dynamic routes Getting ready How to do it... How it works... There's more... Offering snippets to the user Getting ready How to do it... How it works... There's more... Getting input from users Getting ready How to do it... How it works... There's more... Managing Search Engine Optimization (SEO) options Getting ready How to do it... How it works... There's more... Managing sitemaps for the website Getting ready... How to do it... How it works... Getting a visitor's country information Getting ready... How to do it... How it works... Tracking a marketing campaign Getting ready How to do it... How it works... Managing multiple websites Getting ready How to do it... How it works... Web Client Development Introduction Technical requirements Creating custom widgets Getting ready How to do it... How it works... There's more... Using client-side QWeb templates Getting ready How to do it... How it works... There's more... See also Making RPC calls to the server Getting ready How to do it... How it works... There's more... See also Creating a new view Getting ready How to do it... How it works... There's more... Debugging your client-side code Getting ready How to do it... How it works... There's more... Improving onboarding with tour Getting ready How to do it... How it works... Mobile app JavaScript Getting ready How to do it... How to works... There's more... In-App Purchasing with Odoo Introduction Technical requirements In-app purchase concepts How it works... The IAP service flow There's more... Registering an IAP service in Odoo Getting ready How to do it... How it works... Creating an IAP service module Getting ready How to do it... How it works... Authorizing and charging IAP credits Getting ready How to do it... How it works... There's more... See also Creating an IAP client module Getting ready How to do it... How it works... There's more... Displaying offers when an account lacks credits Getting ready How to do it... How it works... There's more... Automated Test Cases Introduction Technical requirements Python test cases Getting ready How to do it... How it works... There's more... Running tagged Python test cases Getting ready How to do it... How it works... There's more... Setting up Headless Chrome for client-side test cases How to do it... How it works... Client-side QUnit test cases Getting ready How to do it... How it works... There's more... Adding tour test cases Getting ready How to do it... How it works... Running client-side test cases from the UI How to do it... Running QUnit test cases Running tours from the UI How it works... Debugging client-side test cases Getting ready How to do it... How it works... Generating videos/screenshots for failed test cases How to do it... How it works... Managing, Deploying, and Testing with Odoo.sh Introduction Technical requirements Exploring some basic concepts of Odoo.sh What is Odoo.sh? Why was Odoo.sh introduced? When should you use Odoo.sh? What are the features of Odoo.sh? Creating an Odoo.sh account Getting ready How to do it... How it works... There's more... Adding and installing custom modules Getting ready How to do it... How it works... There's more... Managing branches Getting ready How to do it... Creating the production branch Creating a development branch Creating a staging branch Merging new features in the production branch How it works... Accessing debugging options How to do it... Branch history Mail catcher Web shell Code editor Logs There's more... Getting a backup of your instance How to do it... How it works... Checking the status of your builds How to do it... How it works... There's more... All Odoo.sh options Getting ready How to do it... Project name Collaborators Public access Module installation Submodules Database workers Staging branches There's more... Database size Odoo source code revisions Remote Procedure Calls in Odoo Technical requirements Logging in/connecting Odoo with XML-RPC Getting ready How to do it... How it works... There's more... Searching/reading records through XML-RPC Getting ready How to do it... How it works... There's more... Creating/updating/deleting records through XML-RPC Getting ready How to do it... How it works... There's more... Calling methods through XML-RPC Getting ready How to do it... How it works... There's more... Logging in/connecting Odoo with JSON-RPC Getting ready How to do it... How it works... There's more... Fetching/searching records through JSON-RPC Getting ready How to do it... How it works... There's more... Create/update/delete records through JSON-RPC Getting ready How to do it... How it works... There's more... Calling methods through JSON-RPC Getting ready How to do it... How it works... The OCA odoorpc library Getting ready How to do it... How it works... There's more... See also Performance Optimization The prefetching pattern for the recordsets How to do it... How it works... There's more... The in-memory cache – ormcache How to do it... ormcache ormcache_context ormcache_multi How it works... There's more... Generating image thumbnails How to do it... How it works... There's more... Accessing grouped data How to do it... How it works... There's more... Creating or writing multiple records How to do it... How it works... There's more... Accessing records through database queries How to do it... How it works... There's more... Profiling Python code How to do it... How it works... There's more... Point of Sale Introduction Technical requirements Adding custom JavaScript/SCSS files Getting ready How to do it... How it works... There's more... Adding an action button on the keyboard Getting ready How to do it... How it works... There's more... Making RPC calls Getting ready How to do it... How it works... Modifying the POS screen UI Getting ready How to do it... How it works... Modifying existing business logic Getting ready How to do it... How it works... Modifying customer receipts Getting ready How to do it... How it works... There's more... Manage Emails in Odoo Technical requirements Configuring incoming and outgoing mail servers Getting ready How to do it... Configuring the incoming mail server Configuring the outgoing mail server How it works... There's more... Managing chatter on documents Getting ready How to do it... How it works... There is more... Managing activities on documents Getting ready How to do it... How it works... There's more... Sending mail using the Jinja template Getting ready How to do it... How it works... There's more... Sending mail using the QWeb template Getting ready How to do it... How it works... There's more... Managing the mail alias Getting ready How to do it... How it works... There's more... Logging user changes in chatter Getting ready How to do it... How it works... IoT Box Technical requirements Flashing the IoT Box image for Raspberry Pi Getting ready How to do it... How it works... There's more... Connecting the IoT Box with the network Getting ready How to do it... How it works... Adding the IoT Box to Odoo Getting ready How to do it... Connecting the IoT Box automatically Connecting the IoT Box manually How it works... There's more... Loading drivers and listing connected devices Getting ready How to do it... How it works... Taking input from devices Getting ready How to do it... How it works... There is more... Accessing the IoT Box through SSH Getting ready How it works... How to do it... There's more... Configuring a point of sale Getting ready How to do it... How it works... There's more... Other Book You May Enjoy Leave a review - let other readers know what you think