Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f3f3778
docs(spp_farmer_registry_demo): rewrite USE_CASES.md + close eligibil…
emjay0921 May 5, 2026
997a381
feat(spp_farmer_registry_demo): add Scenario 10 (GIS+irrigation), far…
emjay0921 May 7, 2026
e5e5925
fix(spp_farmer_registry_demo): QA round-3 corrections (#915)
emjay0921 May 15, 2026
6c8a746
fix(spp_farmer_registry_demo): drop 'Demo' prefix from spp_demo users…
emjay0921 May 15, 2026
2e5b32c
fix(spp_farmer_registry_demo): use spp.phone.number for persona phone…
emjay0921 May 15, 2026
cc5e7f7
fix(spp_farmer_registry_demo): two-way phone + extend phone/bank to s…
emjay0921 May 15, 2026
915f24a
fix(spp_farmer_registry_demo): proper RELATIONSHIPS hide + move GIS L…
emjay0921 May 15, 2026
b66c884
feat(spp_farmer_registry_demo): seed registry IDs (national_id, passp…
emjay0921 May 15, 2026
445c526
feat(spp_farmer_registry_demo): seed birthdate + gender on all demo i…
emjay0921 May 15, 2026
8c83007
fix(spp_farmer_registry_demo): gender vocab lookup uses ISO 5218 code…
emjay0921 May 15, 2026
194763e
feat(spp_farmer_registry_demo): expand service points + seed Service …
emjay0921 May 15, 2026
338d283
feat(spp_farmer_registry_demo): link service points onto farm groups …
emjay0921 May 15, 2026
bb6aa3b
fix(spp_farmer_registry_demo): vary service-point count per farm so g…
emjay0921 May 15, 2026
50eb149
fix(spp_farmer_registry_demo): anchor farm GPS to verified farmland p…
emjay0921 May 15, 2026
da15770
fix(spp_farmer_registry_demo): round-5 QA corrections (#915)
emjay0921 May 19, 2026
23bf27e
docs(spp_farmer_registry_demo): correct Scenario 1 enrollment flow (#…
emjay0921 May 19, 2026
421f9bd
docs(spp_farmer_registry_demo): correct scenario UI references audite…
emjay0921 May 19, 2026
a11782d
fix(spp_farmer_registry_demo): round-6 QA corrections — story data, C…
emjay0921 May 28, 2026
59b6460
fix(spp_farmer_registry_demo): make cycle / payment generation determ…
emjay0921 May 28, 2026
299ff77
fix(spp_farmer_registry_demo): round-7 QA — compliance, entitlement f…
emjay0921 Jun 8, 2026
b47a63a
fix(spp_farmer_registry_demo): repair demo load crash + farm-user cyc…
emjay0921 Jun 8, 2026
2179035
fix(farmer_demo): add a working program cycle approver user (#915)
emjay0921 Jun 17, 2026
b77fe9c
Merge remote-tracking branch 'origin/19.0' into docs/915-farmer-regis…
emjay0921 Jun 22, 2026
bf54367
chore(farmer_demo): regenerate READMEs and format irrigation view (#915)
emjay0921 Jun 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 45 additions & 33 deletions spp_farmer_registry/data/cel_variables.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
- Benefit calculations (farm_size_hectares * per_hectare_rate)
- Program targeting (crop_count, livestock_count)
-->
<odoo noupdate="1">
<!-- noupdate="0" so the activity-count CEL variable fix from OP#915 lands
on existing installs. Variables in this file are flagged is_system=True
and shouldn't be hand-edited; if an admin did override one, they'll get
the system definition back on the next upgrade. -->
<odoo noupdate="0">
<!-- ═══════════════════════════════════════════════════════════════════════
FIELD VARIABLES - Direct field access from spp.farm.details
═══════════════════════════════════════════════════════════════════════ -->
Expand Down Expand Up @@ -78,6 +82,23 @@
AGGREGATE VARIABLES - Activity Counts
═══════════════════════════════════════════════════════════════════════ -->

<!-- The five activity-count / livestock-sum variables below were
originally declared with `source_type="aggregate"` and an
`aggregate_target` pointing at non-existent inverse names like
`farm_aquaculture_activities` (the real o2m field is
`farm_aquaculture_act_ids`). On top of that, the CEL framework's
`aggregate_target` field is a Selection limited to
members/enrollments/entitlements, so even with the right name
the lookup wouldn't have worked. Net effect: every variable
resolved to 0 for every farm, so the demo programs' CELs (e.g.
`aquaculture_count > 0`) returned 0 matches even though seeded
enrollments existed. See OP#915.

The fix: each variable now reads from the corresponding stored
Integer compute on `spp.farm` (already maintained by
`_compute_activity_counts` / `_compute_total_livestock_heads`).
No new model fields, no aggregate framework needed. -->

<record id="var_crop_count" model="spp.cel.variable">
<field name="name">crop_count</field>
<field name="label">Number of Crop Activities</field>
Expand All @@ -86,15 +107,13 @@
>Count of crop cultivation activities on the farm</field>
<field name="category_id" ref="variable_category_farm_activity" />
<field name="value_type">number</field>
<field name="source_type">aggregate</field>
<field name="aggregate_type">count</field>
<field name="aggregate_target">farm_crop_activities</field>
<field name="aggregate_filter">true</field>
<field name="source_type">field</field>
<field name="source_model">res.partner</field>
<field name="source_field">crop_activity_count</field>
<field name="cel_accessor">crop_count</field>
<field name="applies_to">group</field>
<field name="is_system">True</field>
<field name="cache_strategy">ttl</field>
<field name="cache_ttl_seconds">86400</field>
<field name="cache_strategy">none</field>
</record>

<record id="var_livestock_count" model="spp.cel.variable">
Expand All @@ -105,15 +124,13 @@
>Count of livestock rearing activities on the farm</field>
<field name="category_id" ref="variable_category_farm_activity" />
<field name="value_type">number</field>
<field name="source_type">aggregate</field>
<field name="aggregate_type">count</field>
<field name="aggregate_target">farm_livestock_activities</field>
<field name="aggregate_filter">true</field>
<field name="source_type">field</field>
<field name="source_model">res.partner</field>
<field name="source_field">livestock_activity_count</field>
<field name="cel_accessor">livestock_count</field>
<field name="applies_to">group</field>
<field name="is_system">True</field>
<field name="cache_strategy">ttl</field>
<field name="cache_ttl_seconds">86400</field>
<field name="cache_strategy">none</field>
</record>

<record id="var_aquaculture_count" model="spp.cel.variable">
Expand All @@ -122,15 +139,13 @@
<field name="description">Count of aquaculture activities on the farm</field>
<field name="category_id" ref="variable_category_farm_activity" />
<field name="value_type">number</field>
<field name="source_type">aggregate</field>
<field name="aggregate_type">count</field>
<field name="aggregate_target">farm_aquaculture_activities</field>
<field name="aggregate_filter">true</field>
<field name="source_type">field</field>
<field name="source_model">res.partner</field>
<field name="source_field">aquaculture_activity_count</field>
<field name="cel_accessor">aquaculture_count</field>
<field name="applies_to">group</field>
<field name="is_system">True</field>
<field name="cache_strategy">ttl</field>
<field name="cache_ttl_seconds">86400</field>
<field name="cache_strategy">none</field>
</record>

<record id="var_land_parcel_count" model="spp.cel.variable">
Expand All @@ -139,34 +154,31 @@
<field name="description">Count of registered land parcels for the farm</field>
<field name="category_id" ref="variable_category_farm" />
<field name="value_type">number</field>
<field name="source_type">aggregate</field>
<field name="aggregate_type">count</field>
<field name="aggregate_target">land_parcels</field>
<field name="aggregate_filter">true</field>
<field name="source_type">field</field>
<field name="source_model">res.partner</field>
<field name="source_field">land_parcel_count</field>
<field name="cel_accessor">land_parcel_count</field>
<field name="applies_to">group</field>
<field name="is_system">True</field>
<field name="cache_strategy">ttl</field>
<field name="cache_ttl_seconds">86400</field>
<field name="cache_strategy">none</field>
</record>

<!-- Total livestock heads (sum of quantities) -->
<!-- Total livestock heads (sum of quantities) — backed by the stored
`total_livestock_heads` compute on spp.farm, which sums
farm_livestock_act_ids.quantity. -->
<record id="var_total_livestock_heads" model="spp.cel.variable">
<field name="name">total_livestock_heads</field>
<field name="label">Total Livestock Heads</field>
<field name="description">Sum of all livestock across all activities</field>
<field name="category_id" ref="variable_category_farm_activity" />
<field name="value_type">number</field>
<field name="source_type">aggregate</field>
<field name="aggregate_type">sum</field>
<field name="aggregate_target">farm_livestock_activities</field>
<field name="aggregate_field">quantity</field>
<field name="aggregate_filter">true</field>
<field name="source_type">field</field>
<field name="source_model">res.partner</field>
<field name="source_field">total_livestock_heads</field>
<field name="cel_accessor">total_livestock_heads</field>
<field name="applies_to">group</field>
<field name="is_system">True</field>
<field name="cache_strategy">ttl</field>
<field name="cache_ttl_seconds">86400</field>
<field name="cache_strategy">none</field>
</record>

<!-- ═══════════════════════════════════════════════════════════════════════
Expand Down
8 changes: 5 additions & 3 deletions spp_farmer_registry_cr/data/cr_types.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,17 @@
<field name="source_module">spp_farmer_registry_cr</field>
</record>

<!-- Manage Farm Assets (Add/Edit/Remove) — disabled until fully tested
<!-- Manage Farm Assets (Add/Edit/Remove) -->
<record id="cr_type_manage_farm_asset" model="spp.change.request.type">
<field name="name">Manage Farm Assets</field>
<field name="code">manage_farm_asset</field>
<field name="description">Add, edit, or remove farm assets and machinery</field>
<field name="target_type">group</field>
<field name="detail_model">spp.cr.detail.manage_farm_asset</field>
<field name="detail_form_view_id" ref="spp_farmer_registry_cr.spp_cr_detail_manage_farm_asset_form"/>
<field
name="detail_form_view_id"
ref="spp_farmer_registry_cr.spp_cr_detail_manage_farm_asset_form"
/>
<field name="apply_strategy">custom</field>
<field name="apply_model">spp.cr.apply.manage_farm_asset</field>
<field name="icon">fa-wrench</field>
Expand All @@ -168,7 +171,6 @@
<field name="is_system_type">True</field>
<field name="source_module">spp_farmer_registry_cr</field>
</record>
-->

<!-- Manage Land Parcels (Add/Edit/Remove) — disabled until fully tested
<record id="cr_type_manage_land_parcel" model="spp.change.request.type">
Expand Down
18 changes: 18 additions & 0 deletions spp_farmer_registry_demo/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,24 @@ Dependencies
Changelog
=========

19.0.2.1.0
~~~~~~~~~~

- feat(demo): add GIS + irrigation scenario (FM4) with reservoir + canal
network seed; FM4's idle hectare is now narratively explained as the
downstream consequence of reduced reservoir capacity
- feat(demo): seed farm assets (hand tractor on FM1, water pump on FM8)
and a ``manage_farm_asset`` change request in the CR lifecycle
- feat(demo): add a closed prior-year farm season alongside the active
one to demonstrate the ``draft → active → closed`` state machine
- chore(deps): declare ``spp_gis``, ``spp_land_record``,
``spp_irrigation``, ``spp_farmer_registry_vocabularies`` explicitly —
these were used at runtime but never listed
- docs(demo): add Scenario 10 (GIS + irrigation walk for FM4); document
AGROVOC species selection (rice / tilapia) in Scenario 1; add
farm-season state-machine sub-step; refresh FM1/FM4/FM8 farm story
tables and the CR overview

19.0.2.0.0
~~~~~~~~~~

Expand Down
15 changes: 14 additions & 1 deletion spp_farmer_registry_demo/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "OpenSPP Farmer Registry Demo",
"summary": "Demo generator for Farmer Registry with fixed stories and volume generation",
"category": "OpenSPP",
"version": "19.0.2.0.0",
"version": "19.0.2.1.0",
"sequence": 1,
"author": "OpenSPP.org",
"website": "https://github.com/OpenSPP/OpenSPP2",
Expand All @@ -25,16 +25,29 @@
"spp_area",
# Programs (explicitly used for cycles, entitlements, payments)
"spp_programs",
# GIS / land / irrigation — used by Scenario 10 (FM4 GIS+irrigation walk)
"spp_gis",
"spp_land_record",
"spp_irrigation",
# Registrant GIS — adds the Location/coordinates group on the Profile
# tab; our view inherits move it to the end of the tab.
"spp_registrant_gis",
# FAO vocabularies — surface AGROVOC species selection in scenarios
"spp_farmer_registry_vocabularies",
],
"external_dependencies": {},
"data": [
"security/ir.model.access.csv",
"data/demo_users.xml",
"data/approval_definitions.xml",
"data/approval_links.xml",
"data/demo_personas.xml",
"data/demo_programs.xml",
"data/logic_packs.xml",
"data/disable_group_types.xml",
"data/service_types.xml",
"views/farmer_demo_wizard_view.xml",
"views/group_form_overrides.xml",
],
"assets": {},
"demo": [],
Expand Down
93 changes: 93 additions & 0 deletions spp_farmer_registry_demo/data/approval_definitions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Farmer Registry Demo - Approval Definitions

Cycle and entitlement approval definitions consumed by the demo wizard.
`farmer_demo_generator.py` wires these onto each program's cycle manager
and entitlement manager so the demo programs actually enter the approval
workflow when cycles are created or entitlements are disbursed.

Mirrors `spp_mis_demo_v2/data/approval_definitions.xml` in shape; we add
them in farmer demo because MIS demo never assigns these to the program
managers (a gap to be fixed in MIS via a separate ticket).
-->
<odoo noupdate="1">
<!-- Cycle approval — Cycle Approver.
Cycle approval is gated on the Cycle Approver functional role, which is
the group the "Approve Cycle" button is shown to and the role purpose-
built for this in spp_programs. A Program Manager is intentionally NOT
a Cycle Approver in the program group hierarchy, so cycle approval must
route through this group for the dedicated approver to approve (OP#915).
The xmlid is kept stable because farmer_demo_generator wires it onto
each program's cycle manager by id. -->
<record
id="approval_definition_farmer_cycle_manager"
model="spp.approval.definition"
>
<field name="name">Farmer: Cycle Approval - Cycle Approver</field>
<field name="model_id" ref="spp_programs.model_spp_cycle" />
<field name="approval_type">group</field>
<field
name="approval_group_id"
ref="spp_programs.group_programs_cycle_approver"
/>
<field name="is_require_comment">False</field>
<field name="notify_on_submit">True</field>
<field name="sla_days">3</field>
<field name="active">True</field>
</record>

<!-- Entitlement approval — Program Manager -->
<record
id="approval_definition_farmer_entitlement_manager"
model="spp.approval.definition"
>
<field name="name">Farmer: Entitlement Approval - Program Manager</field>
<field name="model_id" ref="spp_programs.model_spp_entitlement" />
<field name="approval_type">group</field>
<field name="approval_group_id" ref="spp_programs.group_programs_manager" />
<field name="is_require_comment">False</field>
<field name="notify_on_submit">True</field>
<field name="sla_days">3</field>
<field name="active">True</field>
</record>

<!-- Entitlement approval — Cycle Approver (alternate path used by some
programs that route through cycle approvers rather than managers). -->
<record
id="approval_definition_farmer_entitlement_cycle_approver"
model="spp.approval.definition"
>
<field name="name">Farmer: Entitlement Approval - Cycle Approver</field>
<field name="model_id" ref="spp_programs.model_spp_entitlement" />
<field name="approval_type">group</field>
<field
name="approval_group_id"
ref="spp_programs.group_programs_cycle_approver"
/>
<field name="is_require_comment">False</field>
<field name="notify_on_submit">True</field>
<field name="sla_days">3</field>
<field name="active">True</field>
</record>

<!-- In-kind entitlement approval — Program Manager. Farmer demo's
entitlements are cash-only today; we still ship the in-kind
definition so admins enabling in-kind variants of the demo
programs get the same approval coverage out of the box. -->
<record
id="approval_definition_farmer_entitlement_inkind_manager"
model="spp.approval.definition"
>
<field
name="name"
>Farmer: In-Kind Entitlement Approval - Program Manager</field>
<field name="model_id" ref="spp_programs.model_spp_entitlement_inkind" />
<field name="approval_type">group</field>
<field name="approval_group_id" ref="spp_programs.group_programs_manager" />
<field name="is_require_comment">False</field>
<field name="notify_on_submit">True</field>
<field name="sla_days">3</field>
<field name="active">True</field>
</record>
</odoo>
14 changes: 10 additions & 4 deletions spp_farmer_registry_demo/data/approval_links.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,15 @@
</record>
-->

<!-- Manage Farm Assets — disabled until CR type is enabled
<record id="spp_farmer_registry_cr.cr_type_manage_farm_asset" model="spp.change.request.type">
<field name="approval_definition_id" ref="spp_farmer_registry_cr.approval_def_farmer_cr_local_to_hq" />
<!-- Manage Farm Assets — same local→HQ tiered approval as the other
farmer CR types (OP#915 round 6). -->
<record
id="spp_farmer_registry_cr.cr_type_manage_farm_asset"
model="spp.change.request.type"
>
<field
name="approval_definition_id"
ref="spp_farmer_registry_cr.approval_def_farmer_cr_local_to_hq"
/>
</record>
-->
</odoo>
Loading
Loading