Module development#

OpenSPP is built on the powerful and flexible Odoo framework. One of the core principles of Odoo is its modular architecture. Instead of modifying the core source code of the platform, customizations and new features are added through self-contained packages called modules.

This guide will walk you through the fundamental process of creating a custom OpenSPP module. We will build a simple but practical module that adds a "National ID" field to the Individual record in the registry.

By the end of this guide, you will understand:

  • Why creating a custom module is the best practice.

  • The basic structure of an OpenSPP/Odoo module.

  • How to extend existing models to add new data fields.

  • How to modify user interface forms to display these new fields.

  • The complete process for installing and activating your custom module.

Why Create a Custom Module?#

For developers new to Odoo, it might seem easier to directly edit the existing OpenSPP files. However, this approach, often called forking, leads to significant long-term problems. The recommended approach is to encapsulate all your customizations within a custom module.

Key Advantages of Using Modules:

  • Maintainability & Upgradability: When a new version or security patch for OpenSPP is released, you can update the core platform code without losing your custom features. Your module remains separate and can be easily installed on the new version, often with minimal changes.

  • Cleanliness & Organization: Your custom code is neatly organized in its own directory, making it easy to find, understand, and manage.

  • Portability: You can easily share your module with other projects or deploy it on different OpenSPP instances.

  • Collaboration: It allows multiple teams to work on different custom features without creating conflicts in the core codebase.

In short, creating modules is the professional standard for Odoo and OpenSPP development that ensures your solution is robust and future-proof.

Best Practices in OpenSPP Development#

For more detailed guidelines, refer to the Best Practices Guide.

Module Customization Guides#

The following guides provide step-by-step instructions for common customization tasks in OpenSPP. Each guide focuses on a specific area of the platform, showing you how to extend its functionality by creating a custom module.

  • Registry fields: Learn how to add new fields to existing models.

  • Registry: Extend the core registry models for individuals and groups.

  • Indicators: Create and manage custom indicators for eligibility checking, reporting, and analysis.

  • Programs: Customize program definitions and behavior.

  • Program cycles: Modify program cycles and their states.

  • Program entitlements: Customize the logic for calculating and managing entitlements.

  • Change Request: Build new types of change requests to handle custom data modification workflows.

  • Document Management System: Extend the Document Management System (DMS) with custom categories and logic.

  • REST API: Create new REST API endpoints for integration with external systems.

  • Areas: Customize geographical area data, such as adding population statistics.

  • Service Points: Extend the functionality of service points.

  • Audit Logs: Configure and extend audit logging for tracking changes to critical data.

  • Dashboards: Develop custom dashboards and reporting views.

References#

For more information on developing OpenSPP modules, refer to: