Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
107 changes: 74 additions & 33 deletions spp_area/views/area_base.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@
<field name="priority">1</field>
<field name="arch" type="xml">
<list>
<field name="name" column_invisible="1"/>
<field name="draft_name" string="Name"/>
<field name="name" column_invisible="1" />
<field name="draft_name" string="Name" />
<field name="altnames" />
<field name="code" />
<field name="parent_id" />
<field name="complete_name" string="Complete Name" />
<field name="area_level" />
<field name="area_type_id" string="Area Type" />
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}" optional="hide" />
<field
name="tag_ids"
widget="many2many_tags"
options="{'color_field': 'color'}"
optional="hide"
/>
</list>
</field>
</record>
Expand All @@ -27,67 +32,89 @@
<sheet>
<!-- Title Section -->
<div class="oe_title">
<label for="parent_id" class="oe_edit_only"/>
<label for="parent_id" class="oe_edit_only" />
<h3 class="text-muted mb-2">
<field
name="parent_id"
placeholder="Select Parent Area..."
options="{'no_open':True,'no_create_edit':True,'no_create':True}"/>
options="{'no_open':True,'no_create_edit':True,'no_create':True}"
/>
</h3>
<label for="name" class="oe_edit_only"/>
<label for="name" class="oe_edit_only" />
<h1>
<field
name="name"
placeholder="Area Name..."
readonly="1"
force_save="1"
class="oe_read_only"/>
class="oe_read_only"
/>
<field
name="draft_name"
placeholder="Enter Area Name..."
class="oe_edit_only"/>
class="oe_edit_only"
/>
</h1>
</div>

<!-- Hidden Fields -->
<field name="level" invisible="1"/>
<field name="level" invisible="1" />

<!-- Main Information -->
<group>
<group name="main_info">
<group string="Basic Information">
<field name="code" placeholder="Area Code..."/>
<field name="altnames"
string="Alternate Names"
placeholder="Alternative names for this area..."/>
<field name="complete_name" readonly="1"/>
<field name="code" placeholder="Area Code..." />
<field
name="altnames"
string="Alternate Names"
placeholder="Alternative names for this area..."
/>
<field name="complete_name" readonly="1" />
</group>
<group string="Classification">
<field name="area_level"/>
<field name="area_type_id"
options="{'no_open': True, 'no_create': True}"/>
<field name="area_sqkm"
string="Area (sq/km)"
widget="float"/>
<field
name="area_level"
string="Admin Level"
help="Hierarchical level of this area, automatically computed from its position in the area tree (0 = top-level)."
/>
<field
name="area_type_id"
string="Area Type"
help="Classification type for this area (e.g., Province, Municipality, Barangay)."
options="{'no_open': True, 'no_create': True}"
/>
<field
name="area_sqkm"
string="Area (km²)"
help="Geographic size of this area in square kilometers."
widget="float"
/>
</group>
</group>

<!-- Tags Section -->
<group string="Tags">
<field name="tag_ids"
widget="many2many_tags"
placeholder="Add tags..."
options="{'color_field': 'color', 'no_create_edit': True}"/>
<field
name="tag_ids"
widget="many2many_tags"
placeholder="Add tags..."
options="{'color_field': 'color', 'no_create_edit': True}"
/>
</group>

<!-- Child Areas -->
<notebook>
<page name="child" string="Child Areas">
<field name="child_ids" nolabel="1">
<list>
<field name="name"/>
<field name="code" optional="show"/>
<field name="area_type_id" string="Type" optional="show"/>
<field name="area_level" optional="hide"/>
<field name="name" />
<field name="code" optional="show" />
<field
name="area_type_id"
string="Type"
optional="show"
/>
<field name="area_level" optional="hide" />
</list>
</field>
</page>
Expand All @@ -106,8 +133,16 @@
<field name="name" />
<field name="parent_id" />
<field name="tag_ids" />
<filter name="grp_parent" string="Parent" context="{'group_by': 'parent_id'}" />
<filter name="grp_level" string="Level" context="{'group_by': 'area_level'}" />
<filter
name="grp_parent"
string="Parent"
context="{'group_by': 'parent_id'}"
/>
<filter
name="grp_level"
string="Level"
context="{'group_by': 'area_level'}"
/>
</search>
</field>
</record>
Expand All @@ -123,7 +158,8 @@
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new Area!
</p><p>
</p>
<p>
Click the create button to enter the information of the Area.
</p>
</field>
Expand Down Expand Up @@ -151,7 +187,12 @@
sequence="0"
/>

<menuitem id="area_main_top_menu" name="Areas" parent="area_main_menu_root" sequence="10" />
<menuitem
id="area_main_top_menu"
name="Areas"
parent="area_main_menu_root"
sequence="10"
/>

<menuitem
id="menu_spparea"
Expand Down
8 changes: 4 additions & 4 deletions spp_gis_report/models/area_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ class Area(models.Model):
# ===== Reference Data for Normalization =====
population = fields.Integer(
"Population",
help="Total population from census or estimate",
help="Total population from census or official estimate. Used for per-capita normalization in GIS reports.",
)
population_date = fields.Date(
"Population Data Date",
help="Date of population data",
help="Date when the population data was collected or published.",
)
population_source = fields.Char(
"Population Data Source",
help="Source of population data (e.g., 'National Census 2020')",
help="Source of the population data, e.g., 'National Census 2020' or 'UNFPA Estimate'.",
)

household_count = fields.Integer(
"Household Count",
help="Number of households in this area",
help="Number of households in this area. Used for per-household normalization in GIS reports.",
)

# ===== Registry Counts (Updated via scheduled refresh) =====
Expand Down
16 changes: 10 additions & 6 deletions spp_gis_report/views/area_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,21 @@ Part of OpenSPP. See LICENSE file for full copyright and licensing details.
<field name="inherit_id" ref="spp_area.view_spparea_form" />
<field name="priority">20</field>
<field name="arch" type="xml">
<!-- Add Reference Data section after area_sqkm field -->
<xpath expr="//field[@name='area_sqkm']" position="after">
<!-- Add Reference Data section after the main info group -->
<xpath expr="//group[@name='main_info']" position="after">
<separator string="Reference Data for GIS Reports" />
<div class="text-muted small mb-2">
These fields are populated from external sources such as national census data or official estimates.
They are used for normalization in GIS reports (e.g., per-capita or per-household calculations).
</div>
<group name="gis_reference_data" col="2">
<group name="population_group">
<field name="population" />
<field name="population_date" />
<field name="population_source" />
<field name="population" readonly="1" />
<field name="population_date" readonly="1" />
<field name="population_source" readonly="1" />
</group>
<group name="household_group">
<field name="household_count" />
<field name="household_count" readonly="1" />
</group>
</group>
</xpath>
Expand Down
Loading