Summary View
A brief discussion about the summary view in PBMS odoo user interface followed by ways to customize the same
Summary lines (the underlying model responsible for rendering the summary view) runs onclick of the View <Eligibility/Entitlement> List button via the method _compute_summary_lines

The programmatic flow is as follows
Clear existing summary lines by
wizard.summary_line_ids = [(5, 0, 0)]Fetch configuration parameters
staff_portal_api_url,keymanager_sign_application_idfor formulating a request.Construct an API request payload with
beneficiary_list_idandtarget_registrySign the payload using the
keymanager.providerservice and issues a POST request to the/summaryendpoint of pbms staff portal apiParse the JSON response, which includes two major parts:
beneficiary_list_summary: general summary fields for the listregistry_summary: optional type-specific fields
Iterate over the keys of both summaries (skipping excluded keys like
idandtarget_registry). For each key:If the value is a dictionary (mapping benefit_code_id → value), it resolves the
benefit_mnemonicandmeasurement_unitand creates a line withsummary_type='entitlement'if frombeneficiary_list_summary, or fromregistry_summaryit may use'eligibility'or'entitlement'depending on context.If scalar value, formats numbers (thousands separators) and creates a line with
summary_type='general'or'eligibility'.
Write the list of new lines into
wizard.summary_line_idsas Many2many commands [(0, 0, {...})].The wizard lines are stored in the
g2p.api.summary.linemodel, which has fields:wizard_id(Many2one),key,value, andsummary_type(selection: general / entitlement / eligibility).
This is how the summary lines are stored as key value pairs instead of hard coded column headers making them easy to customize.

Each section corresponds to a summary_type:
General: for overall beneficiary list metrics.
Eligibility: for demographic or eligibility data.
Entitlement: for benefit distribution and entitlement statistics.
<page string="Summary">
<group>
<strong><field name="general_title" readonly="1" widget="handle_display"/></strong>
<field name="summary_general_line_ids" nolabel="1">
<tree create="false" edit="false">
<field name="key"/><field name="value"/>
</tree>
</field>
</group>
<group>
<strong><field name="eligibility_group_title" readonly="1" widget="handle_display"/></strong>
<field name="summary_eligibility_line_ids" nolabel="1">
<tree create="false" edit="false">
<field name="key"/><field name="value"/>
</tree>
</field>
</group>
<group>
<strong><field name="entitlement_group_title" readonly="1" widget="handle_display"/></strong>
<field name="summary_entitlement_line_ids" nolabel="1">
<tree create="false" edit="false">
<field name="key"/><field name="value"/>
</tree>
</field>
</group>
</page>Last updated
Was this helpful?

