Skip to content

Commit 9257091

Browse files
emjay0921kneckinator
authored andcommitted
fix buttons on program membership view
1 parent 052b8db commit 9257091

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

spp_manual_eligibility/__manifest__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
],
1818
"data": [
1919
"views/program_view.xml",
20+
"views/program_membership_view.xml",
2021
"wizard/create_program_wizard.xml",
2122
],
2223
"assets": {},

spp_manual_eligibility/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22

33
from . import eligibility_manager
44
from . import program
5+
from . import program_membership
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Part of OpenSPP. See LICENSE file for full copyright and licensing details.
2+
import logging
3+
4+
from odoo import fields, models
5+
6+
_logger = logging.getLogger(__name__)
7+
8+
9+
class G2PProgramMembership(models.Model):
10+
_inherit = "g2p.program_membership"
11+
12+
is_manual_eligibility = fields.Boolean(compute="_compute_is_manual_eligibility")
13+
14+
def _compute_is_manual_eligibility(self):
15+
for rec in self:
16+
is_manual_eligibility = False
17+
curr_eligibility_manager = self.env["g2p.program_membership.manager.default"].search(
18+
[("program_id", "=", rec.program_id.id), ("is_manual_eligibility", "=", True)]
19+
)
20+
if curr_eligibility_manager:
21+
is_manual_eligibility = True
22+
23+
rec.is_manual_eligibility = is_manual_eligibility
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<!--
3+
Part of OpenSPP. See LICENSE file for full copyright and licensing details.
4+
-->
5+
<odoo>
6+
<record id="view_program_membership_manual_eligibility_form" model="ir.ui.view">
7+
<field name="name">view_program_membership_manual_eligibility_form</field>
8+
<field name="model">g2p.program_membership</field>
9+
<field name="priority">1010</field>
10+
<field name="inherit_id" ref="g2p_programs.view_program_membership_form" />
11+
<field name="arch" type="xml">
12+
<xpath expr="//field[@name='is_group']" position="after">
13+
<field name="is_manual_eligibility" invisible="1" />
14+
</xpath>
15+
<xpath expr="//button[@name='verify_eligibility']" position="attributes">
16+
<attribute name="invisible">
17+
is_manual_eligibility or state not in ('draft','enrolled')
18+
</attribute>
19+
</xpath>
20+
<xpath expr="//button[@name='enroll_eligible_registrants']" position="attributes">
21+
<attribute name="invisible">
22+
is_manual_eligibility or state != 'draft'
23+
</attribute>
24+
</xpath>
25+
</field>
26+
</record>
27+
28+
</odoo>

0 commit comments

Comments
 (0)