Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
105 changes: 73 additions & 32 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 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 (sq km)"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with other parts of the application (e.g., spp_gis_report/__manifest__.py which uses km²), consider using the squared symbol for square kilometers. This is a more standard and concise representation.

Suggested change
string="Area (sq km)"
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
20 changes: 16 additions & 4 deletions spp_gis_report/views/area_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,24 @@ Part of OpenSPP. See LICENSE file for full copyright and licensing details.
<separator string="Reference Data for GIS Reports" />
<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"
help="Total population from census or official estimate. Used for per-capita normalization in GIS reports."
/>
<field
name="population_date"
help="Date when the population data was collected or published."
/>
<field
name="population_source"
help="Source of the population data, e.g., 'National Census 2020' or 'UNFPA Estimate'."
/>
</group>
<group name="household_group">
<field name="household_count" />
<field
name="household_count"
help="Number of households in this area. Used for per-household normalization in GIS reports."
/>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While adding these descriptive help tooltips in the view is a great improvement for usability, it's a best practice in Odoo development to define them on the model fields themselves (in spp_gis_report/models/area_ext.py). This ensures consistency across all views where these fields might be used and centralizes the documentation.

Consider moving these improved help texts to the model definitions. For example, in area_ext.py:

population = fields.Integer(
    "Population",
    help="Total population from census or official estimate. Used for per-capita normalization in GIS reports.",
)

</group>
</group>
</xpath>
Expand Down
Loading