You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/developer_guide/customization/customizing_indicators.md
+9-74Lines changed: 9 additions & 74 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,10 @@ Examples:
33
33
34
34
## Creating Indicators in a Module
35
35
36
-
In this scenario, we create a complete module that adds indicators to both Individual and Group registries. This follows the same pattern as custom fields but focuses on computed indicators.
36
+
In this scenario, we create a module that adds indicators to both Individual and Group registries. This follows the same pattern as custom fields but focuses on computed indicators.
37
+
38
+
> **Note:**
39
+
> If you use the `spp_custom_field` module, all fields defined on the model will be automatically exposed in the UI. You do **not** need to manually extend views.
37
40
38
41
### 1. Create Module Structure
39
42
@@ -46,16 +49,13 @@ spp_custom_indicators/
46
49
├── models/
47
50
│ ├── __init__.py
48
51
│ └── res_partner.py
49
-
├── views/
50
-
│ ├── individual_views.xml
51
-
│ └── group_views.xml
52
52
└── security/
53
53
└── ir.model.access.csv
54
54
```
55
55
56
56
### 2. Define Module Manifest
57
57
58
-
Create a manifest file that includes the proper dependencies and data files:
58
+
Declare the dependency on `spp_custom_field` (and registry modules):
59
59
60
60
```python
61
61
{
@@ -69,11 +69,10 @@ Create a manifest file that includes the proper dependencies and data files:
69
69
"depends": [
70
70
"g2p_registry_group",
71
71
"g2p_registry_individual",
72
+
"spp_custom_field", # Ensure this is included
72
73
],
73
74
"data": [
74
-
"views/individual_views.xml",
75
-
"views/group_views.xml",
76
-
# "security/ir.model.access.csv", # not needed if you do not add new models
75
+
# No need for view XML if using spp_custom_field
77
76
],
78
77
"application": False,
79
78
"installable": True,
@@ -149,72 +148,10 @@ class G2PRegistrant(models.Model):
149
148
partner.z_ind_indv_age_years =max(age, 0)
150
149
```
151
150
152
-
### 4. Create View Extensions
153
-
154
-
Expose the indicators on both Individuals and Groups UI by extending the existing views.
2. Open the Individual and Group registries and verify the new indicators display in both list and form views.
154
+
2. Open the Individual and Group registries and verify the new indicators display in both list and form views (handled automatically by `spp_custom_field`).
218
155
3. Create or update records and ensure the indicators compute correctly.
219
156
4. Test filtering and searching by indicator values.
220
157
@@ -387,8 +324,6 @@ class TestGroupIndicators(TransactionCase):
0 commit comments