Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
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

Applying and trying proposed pull requests

In the GitHub world, a Pull Request (PR) is a request that's made by a developer so that the maintainers of a project can include some new developments. Such a PR may contain a bug fix or a new feature. These requests are reviewed and tested before being pulled into the main branch.

This recipe explains how to apply a PR to your Odoo project in order to test an improvement or a bug fix.

Getting ready

As in the previous recipe, suppose you reported an issue with partner_address_street3 and received a notification that the issue was solved in a PR, which hasn't been merged in the 14.0 branch of the project. The developer asks you to validate the fix in PR #123. You need to update a test instance with this branch.

You should not try out such branches directly on a production database, so first create a test environment with a copy of the production database (refer to Chapter 1, Installing the Odoo Development Environment).

How to do it…

To apply and try out a GitHub PR for an add-on, you need to perform the following steps:

  1. Stop the instance.
  2. Go to the directory where partner-contact was cloned:
    $ cd ~/odoo-dev/my-odoo/src/partner-contact
  3. Create a local tag for the project so that you can revert to that version in case things break:
    $ git checkout 14.0
    $ git tag 14.0-before-update-$(date --iso)
  4. Pull the branch of the pull request. The easiest way to do this is by using the number of the PR, which should have been communicated to you by the developer. In our example, this is PR number 123:
    $ git pull origin pull/123/head
  5. Update the partner_contact_gender1 add-on module in your database and restart the instance (refer to the Installing and upgrading local add-on modules recipe if you don't know how to update the module).
  6. Test the update—try to reproduce your issue, or try out the feature you wanted.

If this doesn't work, comment on the PR page of GitHub, explaining what you did and what didn't work so that the developer can update the PR.

If it works, say so on the PR page too; this is an essential part of the PR validation process, and it will speed up merging in the main branch.

How it works…

We are using a GitHub feature that enables pull requests to be pulled by number using the pull/nnnn/head branch name, where nnnn is the number of the PR. The Git pull command will merge the remote branch in ours, applying the changes in our code base. After this, we update the add-on module, test it, and report back to the author of the change with regard to any failures or success.

There's more…

You can repeat step 4 of this recipe for different pull requests in the same repository if you want to test them simultaneously. If you are really happy with the result, you can create a branch to keep a reference to the result of the applied changes:

$ git checkout -b 14.0-custom

Using a different branch will help you remember that you are not using the version from GitHub, but a custom one.

Note

The git branch command can be used to list all of the local branches you have in your repository.

From then on, if you need to apply the latest revision of the 14.0 branch from GitHub, you will need to pull it without using --ff-only:

$ git pull origin 14.0
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 €18.99/month. Cancel anytime