Odoo 10 Development Essentials 'BTUUSBDLZPVSEFWFMPQNFOUTLJMMTUPCVJMEQPXFSGVM0EPP CVTJOFTTBQQMJDBUJPOT Daniel Reis BIRMINGHAM - MUMBAI Odoo 10 Development Essentials Copyright © 2016 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: November 2016 Production reference: 1241116 1VCMJTIFECZ1BDLU1VCMJTIJOH-UE -JWFSZ1MBDF -JWFSZ4USFFU #JSNJOHIBN #1#6, ISBN 978-1-78588-488-7 XXXQBDLUQVCDPN Credits Author Copy Editor Daniel Reis Tom Jacob Reviewers Project Coordinator Ray Carnes Shweta H Birwatkar Olivier Dony Commissioning Editor Proofreader Veena Pagare Safis Editing Acquisition Editors Indexer Prachi Bisht Pratik Shirodkar Subho Gupta Content Development Editor Graphics Mehvash Fatima Kirk D'Penha Technical Editors Production Coordinator Prashant Chaudhari Deepika Naik Bhagyashree Rai Khushbu Sutar Foreword When I joined Odoo in 2009, my first task was to deliver training courses for consultants, including technical sessions for new Odoo developers. Daniel's Odoo 10 Development Essentials is the realization of my wishes from these sessions; the companion book I wish I could have given to the participants, to kick-start their first contact with Odoo. Chapter after chapter, he walks you through the creation of your first Odoo app, following best practices at every step. Starting with a solid development environment, you'll soon feel comfortable with your Odoo system, and quickly shape up your typical app. From the model groundwork upwards, you'll learn about each layer, including the latest website features and the integration mechanisms for third-party systems. Most importantly, your journey will include quick references for most important API areas, and before you know it, you will grasp the fundamental design properties of Odoo—minimalism, modularity, extensibility, and scalability. Understanding this will be an invaluable asset for any task you set out to accomplish, and is what sets apart good Odoo developers. This updated edition is a great reference for more experienced developers as well, as it focuses on Odoo 9 and 10, introducing a smarter framework, modern conventions and tools, and the removal of the first Odoo API. The book also includes a wealth of pro tips, acquired through years of experience, that should make a seasoned Odoo developer out of you in no time, without the extra gray hair! Last but not least, Daniel has a natural talent for this, so I promise you'll truly enjoy the Odoo 10 Development Essentials ride! Olivier Dony 3%&OHJOFFS0EPP#FMHJVN About the Author Daniel Reis has been an active contributor in the Odoo community and a speaker at Odoo and other tech events. He is a member of the Board at the Odoo Community Association (OCA) and partner and advisor at Odoo integrator ThinkOpen Solutions. Daniel has a degree in Applied Mathematics, a Master in Business Administration, IT consultancy background, and he currently works as applications manager at Securitas Portugal. About the Reviewer Olivier Dony is a Belgian Civil Engineer graduated from UCL in 2003. Specialized in network engineering, databases, and information security, he has developed a passion for open source software over the 10+ years he has spent in the IT industry. A self-described caffeine-based lifeform, he has found an ideal environment at Odoo Belgium since 2009, where he wears many hats: Community Manager, Security Officer, Research and Development Engineer, to name a few. His first mission at Odoo was to deliver training courses to consultants and developers, as he loves to learn new things every day and to disseminate the knowledge. Away from the keyboard, he is the proud dad of two adorable kids, an enthusiastic reader of all genres, and he nurtures a passion for astrophysics, vintage space technology, and of course, coffee! www.PacktPub.com For support files and downloads related to your book, please visit XXX1BDLU1VCDPN. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at XXX1BDLU1VCDPN and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at TFSWJDF!QBDLUQVCDPN for more details. At XXX1BDLU1VCDPN, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. IUUQTXXXQBDLUQVCDPNNBQU Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career. Why subscribe? Fully searchable across every book published by Packt Copy and paste, print, and bookmark content On demand and accessible via a web browser Table of Contents Preface 1 Chapter 1: Getting Started with Odoo Development 7 Setting up a host for the Odoo server 7 Provision for a Debian host 8 Creating a user account for Odoo 9 Installing Odoo from the source 10 Initializing a new Odoo database 13 Managing your databases 14 A word about Odoo product versions 15 More server configuration options 16 Odoo server configuration files 16 Changing the listening port 17 The database filter option 17 Managing server log messages 18 Developing from your workstation 18 Using a Linux text editor 19 Installing and configuring Samba 19 Activating the developer tools 21 Installing third-party modules 23 Finding community modules 23 Configuring the addons path 24 Updating the apps list 25 Summary 26 Chapter 2: Building Your First Odoo Application 27 Essential concepts 28 Understanding applications and modules 28 Modifying and extending modules 28 Creating the module basic skeleton 29 A word about licenses 31 Adding to the addons path 32 Installing the new module 32 Upgrading a module 33 The server development mode 34 The model layer 35 Creating the data model 35 Adding automated tests 38 The view layer 39 Adding menu items 39 Creating the form view 41 Business document form views 42 Adding action buttons 42 Using groups to organize forms 43 The complete form view 44 Adding list and search views 44 The business logic layer 45 Adding business logic 46 Adding tests 47 Setting up access security 47 Testing access security 47 Adding access control security 49 Row-level access rules 51 Better describing the module 52 Summary 53 Chapter 3: Inheritance – Extending Existing Applications 54 Adding sharing capabilities to the To-Do app 54 Extending models 56 Adding fields to a model 57 Modifying existing fields 58 Modifying model methods 59 Extending views 61 Extending the form view 63 Extending the tree and search views 64 More model inheritance mechanisms 65 Copying features with prototype inheritance 65 Embedding models using delegation inheritance 66 Adding the social network features 67 Modifying data 69 Modifying menu and action records 69 Modifying security record rules 70 Summary 72 Chapter 4: Module Data 73 Understanding external identifiers 73 [ ii ] Finding external identifiers 76 Exporting and importing data 77 Exporting data 77 Importing data 79 Related records in CSV data files 80 Module data 82 Demonstration data 82 XML data files 83 The data noupdate attribute 84 Defining records in XML 85 Setting field values 85 Setting values using expressions 86 Setting values for relation fields 86 Shortcuts for frequently used models 87 Other actions in XML data files 88 Deleting records 88 Triggering functions and workflows 89 Summary 89 Chapter 5: Models – Structuring the Application Data 90 Organizing application features into modules 90 Introducing the todo_ui module 91 Creating models 92 Model attributes 93 Models and Python classes 94 Transient and Abstract models 95 Inspecting existing models 95 Creating fields 97 Basic field types 97 Common field attributes 99 Special field names 100 Relationships between models 102 Many-to-one relationships 103 Many-to-many relationships 103 One-to-many inverse relationships 105 Hierarchic relationships 106 Reference fields using dynamic relationships 107 Computed fields 108 Searching and writing on computed fields 109 Storing computed fields 110 Related fields 110 [ iii ] Model Constraints 111 Summary 112 Chapter 6: Views - Designing the User Interface 113 Defining the user interface with XML files 113 Menu items 114 Window actions 116 Context and domain 117 Context data 117 Domain expressions 118 The form views 120 Dealing with several views of the same type 121 Business document views 121 The header 122 The sheet 125 Title and subtitle 125 Smart buttons area 126 Grouping content in a form 126 Tabbed notebooks 128 View semantic components 128 Fields 128 Labels for fields 129 Relational fields
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages289 Page
-
File Size-