官术网_书友最值得收藏!

  • Odoo Development Cookbook
  • Holger Brunn Alexandre Fayolle Daniel Reis
  • 407字
  • 2021-07-16 11:00:31

Installing addon modules from GitHub

GitHub is a great source of third-party addons. A lot of Odoo partners use GitHub to share the addons they maintain internally, and the Odoo Community Association (OCA) collectively maintains several hundreds of addons on GitHub. Before starting to write your own addon, be sure to check that nothing already exists that you could 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 addon modules it contains available in your instance.

Getting ready

Suppose you want to change the way addresses are handled in your instance; your customer needs a third field in addition to Odoo's two (street and street2) to store addresses. You could certainly write your own addon to add a field on res.partner, but the issue is a bit trickier than it seems if you want the address to be properly formatted on invoices. Fortunately, someone on a mailing list tells you about the partner_address_street3 addon that is maintained by the OCA as part of the partner-contact project.

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

How to do it…

To install partner_address_street3, follow these steps:

  1. Go to your project's directory:
    $ cd ~/odoo-dev/my-odoo
    
  2. Clone the 9.0 branch of the partner-contact project in the src/ directory:
    $ git clone --branch 9.0 \
    https://github.com/OCA/partner-contact.git src/partner-contact
    
  3. Change the addons path to include that directory and update the addons list of your instance (see previous recipes, Configure the addons path and Update the addon modules list, of this chapter).
  4. Install the partner_address_street3 addon (see the previous previous recipe, Install and upgrade local addon modules).

How it works…

All the Odoo Community Association code repositories have their addons contained in separate subdirectories, which is coherent with what is expected by Odoo regarding the directories in the addons path; therefore, just cloning the repository somewhere and adding that location in the addons path is enough.

There's more…

Some maintainers follow a different approach and have one addon 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 addons path and clone all the addons from that maintainer you need in this directory. Remember to update the addon modules list each time you add a new repository clone.

主站蜘蛛池模板: 霍山县| 淅川县| 阜城县| 大连市| 揭阳市| 石楼县| 东源县| 石楼县| 云林县| 文昌市| 木里| 闽侯县| 宝兴县| 会同县| 永春县| 旌德县| 辽中县| 如东县| 宝清县| 宿松县| 东海县| 阿瓦提县| 铁岭市| 黄山市| 兴城市| 乳源| 册亨县| 淮阳县| 望奎县| 林口县| 民勤县| 安乡县| 依兰县| 吉隆县| 阜阳市| 富民县| 望奎县| 雷山县| 古蔺县| 武川县| 兰考县|