Skip to content

Commit ee2c93b

Browse files
emjay0921kneckinator
authored andcommitted
hide verify eligibility button on cycle vieww
1 parent ddb8593 commit ee2c93b

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

spp_manual_eligibility/__manifest__.py

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

spp_manual_eligibility/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
from . import eligibility_manager
44
from . import program
55
from . import program_membership
6+
from . import cycle
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 G2PCycle(models.Model):
10+
_inherit = "g2p.cycle"
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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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_cycle_manual_eligibility_form" model="ir.ui.view">
7+
<field name="name">view_cycle_manual_eligibility_form</field>
8+
<field name="model">g2p.cycle</field>
9+
<field name="priority">1010</field>
10+
<field name="inherit_id" ref="g2p_programs.view_cycle_form" />
11+
<field name="arch" type="xml">
12+
<xpath expr="//field[@name='locked']" position="before">
13+
<field name="is_manual_eligibility" invisible="1" />
14+
</xpath>
15+
<xpath expr="//button[@name='check_eligibility']" position="attributes">
16+
<attribute name="invisible">
17+
is_manual_eligibility or state not in ('draft','enrolled')
18+
</attribute>
19+
</xpath>
20+
</field>
21+
</record>
22+
23+
</odoo>

0 commit comments

Comments
 (0)