Skip to content

Commit 80c8f13

Browse files
committed
Merge branch 'refactor-structure' into cleanup-build-errors
2 parents 6707cf2 + cb04353 commit 80c8f13

File tree

185 files changed

+833
-583
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+833
-583
lines changed

.github/workflows/build_deploy.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build and deploy OpenSPP documentation
33
on:
44
push:
55
branches:
6-
- "main"
6+
- "**"
77

88
jobs:
99
build_deploy:
@@ -71,9 +71,11 @@ jobs:
7171
# src: '_build/html/'
7272
# dest: '${{secrets.DEPLOY_USER_DOCS}}@${{secrets.DEPLOY_SERVER_DOCS}}:${{secrets.DEPLOY_PATH_DOCS}}'
7373
- name: Commit documentation changes
74+
if: github.ref == 'refs/heads/main'
7475
uses: peaceiris/actions-gh-pages@v3
7576
with:
7677
github_token: ${{ secrets.GITHUB_TOKEN }}
7778
publish_dir: _build/html
7879
- name: Display status from deploy
80+
if: github.ref == 'refs/heads/main'
7981
run: echo "${{ steps.deploy.outputs.status }}"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
SHELL = bash
44

55
# Include module documentation targets
6-
include Makefile.modules
6+
# include Makefile.modules
77

88
# You can set these variables from the command line.
99
SPHINXOPTS ?=

docs/developer_guide/api_usage/dci_api.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ OpenSPP provides a RESTful API that adheres to the Digital Convergence Initiativ
1515
- Client credentials (Client ID and Client Secret) obtained from the OpenSPP instance.
1616
- Python 3.x and the `requests` library installed (`pip install requests`).
1717

18-
## 1. Authentication: Obtaining an Access Token
18+
## Process
19+
20+
### Authentication: Obtaining an Access Token
1921

2022
The DCI API is secured using OAuth 2.0 with the Client Credentials grant type. Before making any data requests, your application must obtain a bearer token.
2123

2224
- **Endpoint**: `/oauth2/client/token`
2325
- **Method**: `POST`
2426
- **Body**: `x-www-form-urlencoded` with `grant_type`, `client_id`, `client_secret`, `db_name`.
2527

26-
### Example: Get Access Token
28+
**Example: Get Access Token**
2729

2830
```python
2931
import requests
@@ -50,7 +52,7 @@ access_token = token_data.get("access_token")
5052
print("Access Token obtained successfully.")
5153
```
5254

53-
## 2. Searching the Registry
55+
### Searching the Registry
5456

5557
Once authenticated, you can use the access token to perform a synchronous search on the registry.
5658

@@ -61,7 +63,7 @@ Once authenticated, you can use the access token to perform a synchronous search
6163
- `Content-Type`: `application/json`
6264
- **Body**: A JSON object conforming to the DCI `sync/search` request specification.
6365

64-
### Example: Search for an Individual
66+
**Example: Search for an Individual**
6567

6668
```python
6769
search_url = f"{url}/registry/sync/search"
@@ -72,7 +74,7 @@ headers = {
7274
}
7375

7476
# Example search payload based on DCI specification
75-
# This searches for an individual with a specific phone number.
77+
# This searches for an individual with a specific birthdate.
7678
search_payload = {
7779
"header": {
7880
"message_id": "123456789020211216223812",
@@ -103,7 +105,7 @@ search_payload = {
103105
"expression1": {
104106
"attribute_name": "birthdate",
105107
"operator": "eq",
106-
"attribute_value": "06/15/2020"
108+
"attribute_value": "2020-11-02"
107109
}
108110
}
109111
]
@@ -125,7 +127,7 @@ else:
125127
```
126128

127129

128-
## 3. Setup and Configuration
130+
### Setup and Configuration
129131

130132
To use the DCI API, you must first configure a client in OpenSPP.
131133

@@ -135,15 +137,14 @@ To use the DCI API, you must first configure a client in OpenSPP.
135137
4. **Reveal Credentials**: A **Show** button will appear. Click it to reveal the `Client ID` and `Client Secret`.
136138
5. **Important**: Copy these credentials immediately. For security, the **Show** button will disappear after you close the dialog, and you will not be able to retrieve the secret again.
137139

138-
## 4. Best Practices
140+
## Best Practices
139141

140142
1. **Secure Credential Storage**: Never hard-code your `Client ID` or `Client Secret` in your application. Use environment variables or a secure secret management system.
141143
2. **Token Management**: Access tokens are short-lived. Your application should handle token expiration and automatically request a new one when needed.
142144
3. **Error Handling**: Implement robust error handling to manage different HTTP status codes and error responses from the API.
143145
4. **Secure Connections**: Always use HTTPS for all API traffic to protect data in transit.
144146
5. **Logging**: Log request `transaction_id`s and correlation IDs to help with troubleshooting and auditing.
145147

146-
## 5. References
148+
## References
147149

148-
- [DCI Interface Standards v1.0](https://standards.spdci.org/standards/standards-for-interoperability-interfaces/structure-and-versioning-of-the-standards)
149-
- [Odoo 17 Developer Documentation](https://www.odoo.com/documentation/17.0/developer/)
150+
- [DCI Interface Standards v1.0](https://standards.spdci.org/standards/standards-for-interoperability-interfaces/structure-and-versioning-of-the-standards)

docs/developer_guide/api_usage/external_api_jsonrpc.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ This guide explains how to connect to and interact with OpenSPP Registry using t
1515
- User credentials or API key with appropriate permissions.
1616
- Python 3.x and the `requests` library installed (`pip install requests`).
1717

18-
## 1. Understanding JSON-RPC in OpenSPP
18+
## Process
19+
### Understanding JSON-RPC in OpenSPP
1920

2021
OpenSPP exposes much of its data and functionality via JSON-RPC endpoints. You can use these endpoints to authenticate, read, create, update, and delete records from external applications.
2122

2223
**Endpoint:**
2324
- `/jsonrpc` — All JSON-RPC calls (authentication and model methods)
2425

25-
## 1.1 JSON-RPC Payload Structure and Methods
26+
### JSON-RPC Payload Structure and Methods
2627

2728
All interactions with the OpenSPP JSON-RPC API use a standard payload structure. Each request is a JSON object with the following keys:
2829

@@ -59,11 +60,11 @@ payload = {
5960

6061
---
6162

62-
## 1.2 Common Model Methods and Args
63+
### Common Model Methods and Args
6364

6465
When using the `"object"` service with the `"execute_kw"` method, you can call various model methods. Here are the most common:
6566

66-
### `create`
67+
**`create`**
6768
Creates a new record.
6869

6970
**Args:**
@@ -79,7 +80,7 @@ Creates a new record.
7980
**Result:**
8081
Returns the ID of the newly created record.
8182

82-
### `write`
83+
**`write`**
8384
Updates existing records.
8485

8586
**Args:**
@@ -96,7 +97,7 @@ Updates existing records.
9697
**Result:**
9798
Returns a dictionary indicating the result of the update.
9899

99-
### `unlink`
100+
**`unlink`**
100101
Deletes records.
101102

102103
**Args:**
@@ -113,7 +114,7 @@ Deletes records.
113114
Returns a dictionary indicating the result of the deletion.
114115

115116

116-
### `search_read`
117+
**`search_read`**
117118
Searches for records and reads their fields.
118119

119120
**Args:**
@@ -141,7 +142,7 @@ Returns a dictionary of the search results.
141142

142143
---
143144

144-
## 2. Authentication
145+
### Authentication
145146

146147
You must authenticate before accessing most data. Use your password or an API key (recommended).
147148

@@ -170,9 +171,9 @@ if not uid:
170171
print("Authenticated UID:", uid)
171172
```
172173

173-
## 3. Working with Individuals
174+
### Working with Individuals
174175

175-
### Gather the Fields
176+
**Gather The Fields**
176177

177178
For this example we are going to use these fields:
178179

@@ -184,7 +185,7 @@ For this example we are going to use these fields:
184185
- `is_registrant` (boolean, default=True)
185186
- `is_group` (boolean, default=False)
186187

187-
### Example: Create an Individual
188+
**Example: Create an Individual**
188189

189190
```python
190191
# First, get a gender_id (e.g., for "Male")
@@ -254,9 +255,9 @@ updated = response["result"]
254255
print("Result:", updated)
255256
```
256257

257-
## 4. Working with Groups
258+
### Working with Groups
258259

259-
### Required Fields
260+
**Gather The Fields**
260261

261262
For this example we are going to use these fields:
262263

@@ -266,7 +267,7 @@ For this example we are going to use these fields:
266267
- `is_group` (boolean, default=True)
267268

268269

269-
### Example: Create a Group
270+
**Example: Create a Group**
270271

271272
```python
272273
# Get a group kind (e.g., "Household")
@@ -333,9 +334,9 @@ updated = response["result"]
333334
print("Result:", updated)
334335
```
335336

336-
## 5. Working with Memberships
337+
### Working with Memberships
337338

338-
### Required Fields
339+
**Gather The Fields**
339340

340341
From your `g2p_registry_membership` module, the main model is likely `g2p_registry_membership.group_membership`. Required fields typically include:
341342
- `individuak` (many2one, required)
@@ -344,7 +345,7 @@ From your `g2p_registry_membership` module, the main model is likely `g2p_regist
344345
- `start_date` (date, required)
345346
- Any other required fields as defined in your model
346347

347-
### Example: Add an Individual to a Group
348+
**Example: Add an Individual to a Group**
348349

349350
```python
350351
# Get a membership kind (e.g., "Head")
@@ -391,13 +392,13 @@ membership_id = response["result"]
391392
print("Created Membership ID:", membership_id)
392393
```
393394

394-
## 6. Security: Using API Keys
395+
### Security: Using API Keys
395396

396397
- **API keys** are recommended over passwords for scripts and integrations.
397398
- Generate API keys in your OpenSPP user preferences under **Account Security**.
398399
- Use the API key in place of your password in all JSON-RPC calls.
399400

400-
## 7. Best Practices
401+
## Best Practices
401402

402403
1. **Use API Keys**: Safer than passwords; revoke if compromised.
403404
2. **Limit Permissions**: Create dedicated users for API access with only necessary rights.
@@ -408,5 +409,4 @@ print("Created Membership ID:", membership_id)
408409
## References
409410

410411
- [Odoo 17 Developer Documentation](https://www.odoo.com/documentation/17.0/developer/)
411-
- [OpenSPP Developer Guide](https://docs.openspp.org/)
412412
- [JSON-RPC Specification](https://www.jsonrpc.org/specification)

docs/developer_guide/module_development/areas.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,13 @@ Create `data/area_kind_data.xml` to add custom area types:
210210

211211
On your `models/area.py` you can add computed fields, constrains, and validations:
212212

213+
First, add the necessary imports:
214+
```python
215+
from odoo import api, fields, models
216+
from odoo.exceptions import ValidationError
217+
```
218+
213219
```python
214-
# Add api on the import of odoo
215220

216221
area_population_density = fields.Float(
217222
string="Population Density",
@@ -242,6 +247,7 @@ On your `models/area.py` you can add computed fields, constrains, and validation
242247
if record.area_population_year > current_year:
243248
raise ValidationError("Population year cannot be in the future.")
244249
```
250+
Then add the custom computed field to the `area_views.xml` file
245251

246252
### Step 8: Install and Test
247253

docs/developer_guide/module_development/indicators.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ class G2PRegistrant(models.Model):
101101
compute="_compute_ind_grp_num_children",
102102
help="Number of children in the group",
103103
store=True,
104-
allow_filter=True,
105104
)
106105

107106
# Boolean indicator example
@@ -110,7 +109,6 @@ class G2PRegistrant(models.Model):
110109
compute="_compute_ind_grp_is_single_head_hh",
111110
help="Single-headed HH - extracted from demographic data of HH adult members",
112111
store=True,
113-
allow_filter=True,
114112
)
115113

116114
# Individual indicator example
@@ -222,7 +220,6 @@ from odoo import api, ValidationError
222220
## Best Practices
223221

224222
- Use `store=True` for indicators that need to be queried.
225-
- Use `allow_filter=True` for indicators that should be filterable in views.
226223
- Provide clear help text explaining the indicator's purpose.
227224

228225
## References

docs/developer_guide/module_development/registry.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ reviewer: migration-script
55
migration-notes: "Added during 2025 documentation reorganization"
66
---
77

8-
# Customize the Registry
8+
# Registry
99

1010
This article explains how to customize OpenSPP's registry system by introducing a new **top-level group** type. As a practical example, we’ll add a new top-level group type (such as "Village") that can contain regular groups (households), along with custom UI, data, and actions.
1111

@@ -422,6 +422,4 @@ Village A (Top Level Group)
422422
For more information on extending OpenSPP modules, refer to:
423423
- [Odoo 17 Developer Documentation](https://www.odoo.com/documentation/17.0/developer/)
424424
- [OpenSPP Documentation](https://docs.openspp.org/)
425-
- Registry modules: `g2p_registry_group`, `g2p_registry_individual`, `g2p_registry_membership`
426-
- Hierarchy module: `spp_registry_group_hierarchy`
427425
- Related guides: {doc}`Customizing Fields <fields>`, {doc}`Customizing Indicators <indicators>`
242 KB
Loading
85 KB
Loading
243 KB
Loading

0 commit comments

Comments
 (0)