Skip to content

Commit e6a683b

Browse files
committed
Merge branch '17.0-develop' into 17.0-rabbitmq-connector
2 parents 11f44a2 + c487c92 commit e6a683b

File tree

21 files changed

+456
-0
lines changed

21 files changed

+456
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ addon | version | maintainers | summary
3939
[g2p_payment_interop_layer](g2p_payment_interop_layer/) | 17.0.0.0.0 | | OpenG2P Program Payment (Payment Interoperability Layer)
4040
[g2p_payment_phee](g2p_payment_phee/) | 17.0.0.0.0 | | OpenG2P Program Payment (Payment Hub EE)
4141
[g2p_payment_simple_mpesa](g2p_payment_simple_mpesa/) | 17.0.0.0.0 | | OpenG2P Program Payment: Simple Mpesa Payment Manager
42+
[g2p_pbms_socio_economic_model](g2p_pbms_socio_economic_model/) | 17.0.0.0.0 | | G2P PBMS Socio-Economic Model
43+
[g2p_pbms_student_model](g2p_pbms_student_model/) | 17.0.0.0.0 | | G2P PBMS Student Model
4244
[g2p_program_approval](g2p_program_approval/) | 17.0.0.0.0 | | OpenG2P Program: Approval
4345
[g2p_program_assessment](g2p_program_assessment/) | 17.0.0.0.0 | | OpenG2P Program: Assessment
4446
[g2p_program_autoenrol](g2p_program_autoenrol/) | 17.0.0.0.0 | | OpenG2P Programs: Autoenrol
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# G2P PBMS Socio-Economic Model
2+
3+
Refer to https://docs.openg2p.org.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Part of OpenG2P. See LICENSE file for full copyright and licensing details.
2+
3+
from . import models
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Part of OpenG2P. See LICENSE file for full copyright and licensing details.
2+
{
3+
"name": "G2P PBMS Socio-Economic Model",
4+
"category": "G2P",
5+
"version": "17.0.0.0.0",
6+
"sequence": 1,
7+
"author": "OpenG2P",
8+
"website": "https://openg2p.org",
9+
"license": "LGPL-3",
10+
"depends": ["g2p_registry_individual", "g2p_registry_group", "g2p_registry_membership", "g2p_programs"],
11+
"data": ["views/group_view.xml", "views/individual_view.xml", "views/menu_view.xml"],
12+
"assets": {},
13+
"demo": [],
14+
"images": [],
15+
"application": True,
16+
"installable": True,
17+
"auto_install": False,
18+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"name": .name,
3+
"is_group": .isGroup,
4+
"address": .address,
5+
"registration_date": .registrationDate,
6+
"group_membership_ids": (
7+
if .groupMembershipIds? then
8+
[
9+
.groupMembershipIds[] | {
10+
"individual": {
11+
"name": .individual.name,
12+
"given_name": .individual.givenName,
13+
"family_name": .individual.familyName,
14+
"addl_name": .individual.addlName,
15+
"email": .individual.email,
16+
"address": .individual.address,
17+
"registration_date": .individual.registrationDate,
18+
"birth_place": .individual.birthPlace,
19+
"birthdate": .individual.birthdate,
20+
"create_date": .individual.createDate,
21+
"write_date": .individual.writeDate,
22+
"reg_ids": (
23+
if .individual.regIds? then
24+
[.individual.regIds[] | {id_type: {name:.idTypeAsStr}, value: .value}]
25+
else
26+
[]
27+
end
28+
),
29+
"phone_number_ids": (
30+
if .individual.phoneNumberIds? then
31+
[.individual.phoneNumberIds[] | {
32+
phone_no: .phoneNo,
33+
phone_sanitized: .phoneSanitized,
34+
date_collected: .dateCollected,
35+
disabled: .disabled
36+
}]
37+
else
38+
[]
39+
end
40+
)
41+
},
42+
"kind": {name:.kind.name}
43+
}
44+
]
45+
else
46+
[]
47+
end
48+
),
49+
"reg_ids": (
50+
if .regIds? then
51+
[.regIds[] | {id_type: {name:.idTypeAsStr}, value: .value}]
52+
else
53+
[]
54+
end
55+
),
56+
"phone_number_ids": (
57+
if .phoneNumberIds? then
58+
[.phoneNumberIds[] | {
59+
phone_no: .phoneNo,
60+
phone_sanitized: .phoneSanitized,
61+
date_collected: .dateCollected,
62+
disabled: .disabled
63+
}]
64+
else
65+
[]
66+
end
67+
)
68+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Part of OpenG2P. See LICENSE file for full copyright and licensing details.
2+
3+
from . import group_membership
4+
from . import res_partner
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Part of OpenG2P Registry. See LICENSE file for full copyright and licensing details.
2+
3+
import logging
4+
5+
from odoo import fields, models
6+
7+
_logger = logging.getLogger(__name__)
8+
9+
10+
class G2PGroupMembershipInherit(models.Model):
11+
_inherit = "g2p.group.membership"
12+
13+
employment_status = fields.Selection(related="individual.employment_status")
14+
15+
def get_household_head(self, registrant):
16+
if registrant.is_group:
17+
for member in registrant.group_membership_ids:
18+
if member.kind and "Head" in [kind.name for kind in member.kind]:
19+
return member.individual
20+
21+
else:
22+
for member in registrant.individual_membership_ids:
23+
if member.kind and "Head" in [kind.name for kind in member.kind]:
24+
return member.individual
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Part of OpenG2P. See LICENSE file for full copyright and licensing details.
2+
import logging
3+
4+
from odoo import api, fields, models
5+
6+
_logger = logging.getLogger(__name__)
7+
8+
9+
class G2PResPartnerInherited(models.Model):
10+
_inherit = "res.partner"
11+
12+
#######################################################
13+
##### Social Status Information #####
14+
#######################################################
15+
16+
num_preg_lact_women = fields.Integer()
17+
num_malnourished_children = fields.Integer()
18+
num_disabled = fields.Integer()
19+
type_of_disability = fields.Selection(
20+
[
21+
("visual_impairment", "Visual Impairment"),
22+
("hearing_impairment", "Hearing Impairment"),
23+
("physical_disability", "Physical Disability"),
24+
("cognitive_disability", "Cognitive Disability"),
25+
]
26+
)
27+
caste_ethnic_group = fields.Selection(
28+
[
29+
("bantu", "Bantu"),
30+
("nilotic", "Nilotic"),
31+
("afro_asian", "Afro-Asiatic"),
32+
("khoisan", "Khoisan"),
33+
("pygmy", "Pygmy"),
34+
("other", "Other"),
35+
],
36+
)
37+
belong_to_protected_groups = fields.Selection([("yes", "Yes"), ("no", "No")])
38+
other_vulnerable_status = fields.Selection([("yes", "Yes"), ("no", "No")])
39+
40+
#######################################################
41+
##### Household Details #####
42+
#######################################################
43+
44+
education_level = fields.Selection(
45+
[
46+
("primary", "Primary"),
47+
("secondary", "Secondary"),
48+
("higher_secondary", "Higher Secondary"),
49+
("bachelors", "Bachelors"),
50+
("masters", "Masters"),
51+
]
52+
)
53+
employment_status = fields.Selection(
54+
[
55+
("employed_full", "Employed - Full Time"),
56+
("employed_part", "Employed - Part Time"),
57+
("self_employed", "Self-employed"),
58+
("unemployed", "Unemployed"),
59+
]
60+
)
61+
marital_status = fields.Selection(
62+
[("single", "Single"), ("married", "Married"), ("divorced", "divorced")]
63+
)
64+
65+
#######################################################
66+
##### Economic Status Information #####
67+
#######################################################
68+
69+
income_sources = fields.Selection(
70+
[
71+
("agriculture", "Agriculture"),
72+
("business", "Business"),
73+
("mining", "Mining"),
74+
("manufacturing", "Manufacturing"),
75+
("construction", "Construction"),
76+
]
77+
)
78+
# Income field was of INT type and it has validation which will cause the errors.
79+
annual_income = fields.Selection(
80+
[("below_5000", "Below 5000"), ("5001_10000", "5001-10,000"), ("above_10000", "Above 10,000")],
81+
)
82+
owns_two_wheeler = fields.Selection([("yes", "Yes"), ("no", "No")])
83+
owns_three_wheeler = fields.Selection([("yes", "Yes"), ("no", "No")])
84+
owns_four_wheeler = fields.Selection([("yes", "Yes"), ("no", "No")])
85+
owns_cart = fields.Selection([("yes", "Yes"), ("no", "No")])
86+
land_ownership = fields.Selection([("yes", "Yes"), ("no", "No")])
87+
type_of_land_owned = fields.Selection(
88+
[
89+
("agricultural", "Agricultural Land"),
90+
("residential", "Residential Land"),
91+
("pastoral", "Pastoral Land"),
92+
("forest", "Forest Land"),
93+
("commercial", "Commercial Land"),
94+
("communal", "Communal Land"),
95+
("other", "Other"),
96+
]
97+
)
98+
land_size = fields.Float()
99+
owns_house = fields.Selection([("yes", "Yes"), ("no", "No")])
100+
owns_livestock = fields.Selection([("yes", "Yes"), ("no", "No")])
101+
102+
#######################################################
103+
##### Housing Condition Information #####
104+
#######################################################
105+
106+
housing_type = fields.Selection(
107+
[("permanent", "Permanent"), ("temporary", "Temporary")], "Type of Housing"
108+
)
109+
house_condition = fields.Selection([("mud", "Mud"), ("cement", "Cement")])
110+
sanitation_condition = fields.Selection([("yes", "Yes"), ("no", "No")])
111+
water_access = fields.Selection([("yes", "Yes"), ("no", "No")])
112+
electricity_access = fields.Selection([("yes", "Yes"), ("no", "No")])
113+
114+
#######################################################
115+
##### Computed Fields #####
116+
#######################################################
117+
118+
is_hh_unemployed = fields.Boolean(compute="_compute_hh_is_unemployed", store=True)
119+
120+
@api.constrains("group_membership_ids", "employment_status")
121+
def _compute_hh_is_unemployed(self):
122+
for rec in self:
123+
group_head = self.env["g2p.group.membership"].get_household_head(rec)
124+
if group_head:
125+
rec.is_hh_unemployed = group_head.employment_status == "unemployed"
126+
else:
127+
rec.is_hh_unemployed = False
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
3.89 KB
Loading

0 commit comments

Comments
 (0)