Interact With Other Modules

Interact With Other Modules in odoo 14

We used inheritance to modify the behavior of a module. In our sales we would like to go a step further and be able to generate invoices for our customers. Odoo provides an Invoicing module, so it would be neat to create an invoice directly from our real estate module, i.e. once a property is set to ‘Sold’, an invoice is created in the Invoicing application.

Any time we interact with another module, we need to keep in mind the modularity. If we intend to sell our application to real  agencies, some may want the invoicing feature but others may not want it.

Link Module

The common approach for such use cases is to create a ‘link’ module. In our case, the module would depend on sale and purchaase and would include the invoice creation logic of the sale property. This way the real sales and purchase  modules can be installed independently. When both are installed, the link module provides the new feature.

  • Create a link module.Create the sales_purchase module, which depends on the sales and purchase modules. For now, it will be an empty shell.

When the sales_purchase module appears in the list, go ahead and install it! You’ll notice that the Invoicing application is installed as well. This is expected since your module depends on it. If you uninstall the Invoicing application, your module will be uninstalled as well.

Leave a Reply

Your email address will not be published.