Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Odoo 14 Development Cookbook

You're reading from   Odoo 14 Development Cookbook Rapidly build, customize, and manage secure and efficient business apps using Odoo's latest features

Arrow left icon
Product type Paperback
Published in Dec 2020
Publisher Packt
ISBN-13 9781800200319
Length 784 pages
Edition 4th Edition
Languages
Tools
Arrow right icon
Authors (4):
Arrow left icon
Parth Gajjar Parth Gajjar
Author Profile Icon Parth Gajjar
Parth Gajjar
Alexandre Fayolle Alexandre Fayolle
Author Profile Icon Alexandre Fayolle
Alexandre Fayolle
Holger Brunn Holger Brunn
Author Profile Icon Holger Brunn
Holger Brunn
Daniel Reis Daniel Reis
Author Profile Icon Daniel Reis
Daniel Reis
Arrow right icon
View More author details
Toc

Table of Contents (26) Chapters Close

Preface 1. Chapter 1: Installing the Odoo Development Environment 2. Chapter 2: Managing Odoo Server Instances FREE CHAPTER 3. Chapter 3: Creating Odoo Add-On Modules 4. Chapter 4: Application Models 5. Chapter 5: Basic Server-Side Development 6. Chapter 6: Managing Module Data 7. Chapter 7: Debugging Modules 8. Chapter 8: Advanced Server-Side Development Techniques 9. Chapter 9: Backend Views 10. Chapter 10: Security Access 11. Chapter 11: Internationalization 12. Chapter 12: Automation, Workflows, Emails, and Printing 13. Chapter 13: Web Server Development 14. Chapter 14: CMS Website Development 15. Chapter 15: Web Client Development 16. Chapter 16: The Odoo Web Library (OWL) 17. Chapter 17: In-App Purchasing with Odoo 18. Chapter 18: Automated Test Cases 19. Chapter 19: Managing, Deploying, and Testing with Odoo.sh 20. Chapter 20: Remote Procedure Calls in Odoo 21. Chapter 21: Performance Optimization 22. Chapter 22: Point of Sale 23. Chapter 23: Managing Emails in Odoo 24. Chapter 24: Managing the IoT Box 25. Other Books You May Enjoy

Installing add-on modules from GitHub

GitHub is a great source of third-party add-ons. A lot of Odoo partners use GitHub to share the add-ons they maintain internally, and the Odoo Community Association (OCA) collectively maintains several hundred add-ons on GitHub. Before you start writing your own add-on, ensure that you check that nothing already exists that you can use as is or as a starting point.

This recipe will show you how to clone the partner-contact project of the OCA from GitHub and make the add-on modules it contains available in your instance.

Getting ready

Suppose you want to add new fields to the customers (partner) form. By default, the Odoo customers model doesn't have a gender field. If you want to add a gender field, you need to create a new module. Fortunately, someone on a mailing list tells you about the partner_contact_gender add-on module, which is maintained by the OCA as part of the partner-contact project.

The paths that are used in this recipe reflect the layout that was proposed in the Standardizing your instance directory layout recipe.

How to do it…

To install partner_contact_gender, perform the following steps:

  1. Go to your project's directory:
    $ cd ~/odoo-dev/my-odoo/src
  2. Clone the 14.0 branch of the partner-contact project in the src/ directory:
    $ git clone --branch 14.0 \
    https://github.com/OCA/partner-contact.git src/partner-contact
  3. Change the add-ons path to include that directory and update the add-ons list of your instance (refer to the Configuring the add-ons path recipe and Updating the add-on modules list recipes in this chapter). The add-ons_path line of instance.cfg should look like this:
    addons_path = ~/odoo-dev/my-odoo/src/odoo/odoo/addons, \
    ~/odoo-dev/my-odoo/src/odoo/addons, \
    ~/odoo-dev/my-odoo/src/, \
    ~/odoo-dev/local-addons
  4. Install the partner_contact_gender add-on (if you don't know how to install the module, take a look at the previous recipe, Installing and upgrading local add-on modules).

How it works…

All of the Odoo Community Association code repositories have their add-ons contained in separate subdirectories, which is coherent in accordance with what is expected by Odoo regarding the directories in the add-ons path. Consequently, just cloning the repository somewhere and adding that location in the add-ons path is enough.

There's more…

Some maintainers follow a different approach and have one add-on module per repository, living at the root of the repository. In that case, you need to create a new directory, which you will add to the add-ons path and clone all of the add-ons from the maintainer you need in this directory. Remember to update the add-on modules list each time you add a new repository clone.

You have been reading a chapter from
Odoo 14 Development Cookbook - Fourth Edition
Published in: Dec 2020
Publisher: Packt
ISBN-13: 9781800200319
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime