Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c416c26
[UPD] Update g2p_programs.pot
openg2pbot Mar 2, 2025
bf01c04
version changes made in manifest file
Mar 2, 2025
3a3e2b7
Merge pull request #295 from shibu-narayanan/17.0-1.3
shibu-narayanan Mar 2, 2025
35a1a44
Updated version
mkumar-02 Mar 3, 2025
d778471
Merge pull request #296 from mkumar-02/17.0-1.3
shibu-narayanan Mar 3, 2025
213f8d2
Merge branch '17.0-develop' into 17.0-1.3
mkumar-02 Mar 3, 2025
6acfefa
Merge branch 'OpenG2P:17.0-1.3' into 17.0-1.3
mkumar-02 Mar 3, 2025
c176512
Merge pull request #298 from mkumar-02/17.0-1.3
shibu-narayanan Mar 3, 2025
ae5e0d2
Github Workflow: Update actions/cache to v4
mkumar-02 Mar 11, 2025
af52efc
Merge pull request #299 from mkumar-02/17.0-1.3
shibu-narayanan Mar 11, 2025
cf8c978
Differential Entitlement: Add dynamic field for amount computation
mkumar-02 Apr 4, 2025
4663774
Differential Entitlement: Rename amount_type selection values. Add No…
mkumar-02 Apr 4, 2025
eb2ff7e
Differential Entitlement: Add Note in the prepare_entitlements method.
mkumar-02 Apr 4, 2025
fd42281
Merge pull request #301 from mkumar-02/17.0-1.3
shibu-narayanan Apr 4, 2025
9267ca0
[UPD] Update g2p_entitlement_differential.pot
openg2pbot Apr 4, 2025
0375cdd
Add sponsering bank Form and API
amen50 Apr 23, 2025
42a6b3a
Merge pull request #306 from amen50/17.0-1.3
pjoshi751 Apr 23, 2025
a1e0666
[UPD] Update g2p_payment_g2p_connect.pot
openg2pbot Apr 23, 2025
20234f2
[UPD] Update g2p_bridge_configuration.pot
openg2pbot Apr 23, 2025
29c66a7
Remove website module dependency
Q-Niranjan Apr 30, 2025
adabffa
Fix layout issues in login_layout template
Q-Niranjan Apr 30, 2025
f1d3247
fix background image issue
Q-Niranjan Apr 30, 2025
dba436f
Merge pull request #308 from Q-Niranjan/17.0-1.3-theme
shibu-narayanan May 2, 2025
14e27f8
[UPD] Update g2p_theme.pot
openg2pbot May 2, 2025
0b0dc88
Added help desk
May 5, 2025
86c796b
module name changed
May 7, 2025
75a8123
update jwt signature in api calls
amen50 May 9, 2025
5e60bb3
update validation error
amen50 May 9, 2025
d9ef504
remove validation
amen50 May 9, 2025
681aee5
fix pre commit
amen50 May 9, 2025
212403c
Merge pull request #311 from amen50/17.0-1.3
mkumar-02 May 9, 2025
2c3f6ef
fix singleton issue
amen50 May 12, 2025
ad1dce0
Merge pull request #314 from amen50/17.0-1.3
mkumar-02 May 12, 2025
3cf5b06
Merge remote-tracking branch 'upstream/17.0-1.3' into 17.0-develop
lalithkota May 12, 2025
81dd5b7
Merge remote-tracking branch 'shibu/17.0-develop' into 17.0-develop
lalithkota May 12, 2025
ff4f473
G2P Support Desk fixed
lalithkota May 12, 2025
a552b6d
Merge branch '17.0-develop' of https://github.com/openg2p/openg2p-pro…
lalithkota May 20, 2025
5b6d7cf
Added resolution message and time to view
lalithkota Jun 6, 2025
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
34 changes: 34 additions & 0 deletions g2p_entitlement_differential/i18n/g2p_entitlement_differential.pot
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: g2p_entitlement_differential
#: model:ir.model.fields,field_description:g2p_entitlement_differential.field_g2p_program_entitlement_manager_cash_item__amount_field
msgid "Amount Field"
msgstr ""

#. module: g2p_entitlement_differential
#. odoo-python
#: code:addons/g2p_entitlement_differential/models/entitlement_manager.py:0
#, python-format
msgid "Amount Field can't be empty in case of Dynamic Field Amount Type"
msgstr ""

#. module: g2p_entitlement_differential
#: model:ir.model.fields,field_description:g2p_entitlement_differential.field_g2p_program_entitlement_manager_cash_item__amount_type
msgid "Amount Type"
msgstr ""

#. module: g2p_entitlement_differential
#: model:ir.model,name:g2p_entitlement_differential.model_g2p_program_entitlement_manager_cash
msgid "Cash Entitlement Manager"
Expand All @@ -23,6 +40,16 @@ msgstr ""
msgid "Cash Entitlement Manager Items"
msgstr ""

#. module: g2p_entitlement_differential
#: model:ir.model.fields.selection,name:g2p_entitlement_differential.selection__g2p_program_entitlement_manager_cash_item__amount_type__constant
msgid "Constant"
msgstr ""

#. module: g2p_entitlement_differential
#: model:ir.model.fields.selection,name:g2p_entitlement_differential.selection__g2p_program_entitlement_manager_cash_item__amount_type__dynamic_field
msgid "Dynamic Field"
msgstr ""

#. module: g2p_entitlement_differential
#: model:ir.model.fields,field_description:g2p_entitlement_differential.field_g2p_program_entitlement_manager_cash__enable_inflation
#: model_terms:ir.ui.view,arch_db:g2p_entitlement_differential.view_entitlement_manager_cash_form_diff_inherit
Expand All @@ -38,3 +65,10 @@ msgstr ""
#: model:ir.model.fields,field_description:g2p_entitlement_differential.field_g2p_program_entitlement_manager_cash_item__name
msgid "Name"
msgstr ""

#. module: g2p_entitlement_differential
#. odoo-python
#: code:addons/g2p_entitlement_differential/models/entitlement_manager.py:0
#, python-format
msgid "There are no items entered for this entitlement manager."
msgstr ""
127 changes: 117 additions & 10 deletions g2p_entitlement_differential/models/entitlement_manager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Part of OpenG2P. See LICENSE file for full copyright and licensing details.
import logging

from odoo import fields, models
from odoo import _, api, fields, models
from odoo.exceptions import UserError

_logger = logging.getLogger(__name__)


class G2PCashEntitlementManager(models.Model):
Expand All @@ -18,20 +22,108 @@ def _get_all_beneficiaries(self, all_beneficiaries_ids, condition, evaluate_one_
return beneficiaries_ids
return all_beneficiaries_ids

def prepare_entitlements(self, cycle, beneficiaries):
res = super().prepare_entitlements(cycle, beneficiaries)
def prepare_entitlements(self, cycle, beneficiaries): # noqa: C901
# NOTE: This method is an enriched implementation of the prepare_entitlements method
# from spp_entitlement_cash (by OpenSPP):
# <https://github.com/OpenSPP/openspp-modules/tree/17.0/spp_entitlement_cash>

# TODO: Refactor this method once a dedicated _compute_entitlement_amount method is introduced.
if not self.entitlement_item_ids:
raise UserError(_("There are no items entered for this entitlement manager."))

all_beneficiaries_ids = beneficiaries.mapped("partner_id.id")

for ben in all_beneficiaries_ids:
entitlement = self.env["g2p.entitlement"].search(
[("partner_id", "=", ben), ("cycle_id", "=", cycle.id)]
new_entitlements_to_create = {}
for rec in self.entitlement_item_ids:
_logger.info(f"Rec Amount: {rec.amount}")
if rec.condition:
beneficiaries_ids = self._get_all_beneficiaries(
all_beneficiaries_ids, rec.condition, self.evaluate_one_item
)
else:
beneficiaries_ids = all_beneficiaries_ids
_logger.info(f"Beneficiaries IDs: {beneficiaries_ids}")

beneficiaries_with_entitlements = (
self.env["g2p.entitlement"]
.search(
[
("cycle_id", "=", cycle.id),
("partner_id", "in", beneficiaries_ids),
]
)
.mapped("partner_id.id")
)
if entitlement:
if self.inflation_rate and self.enable_inflation:
entitlement.initial_amount = entitlement.initial_amount * self.inflation_rate
entitlements_to_create = [
beneficiaries_id
for beneficiaries_id in beneficiaries_ids
if beneficiaries_id not in beneficiaries_with_entitlements
]

entitlement_start_validity = cycle.start_date
entitlement_end_validity = cycle.end_date
entitlement_currency = rec.currency_id.id

beneficiaries_with_entitlements_to_create = self.env["res.partner"].browse(entitlements_to_create)

for beneficiary_id in beneficiaries_with_entitlements_to_create:
if rec.multiplier_field:
# Get the multiplier value from multiplier_field else return the default multiplier=1
multiplier = beneficiary_id.mapped(rec.multiplier_field.name)
if multiplier:
multiplier = multiplier[0] or 0
else:
multiplier = 1
if rec.max_multiplier > 0 and multiplier > rec.max_multiplier:
multiplier = rec.max_multiplier
_logger.info(f"Multiplier: {multiplier}")

return res
amount = 0.0
if rec.amount_type == "dynamic_field":
if not rec.amount_field:
raise UserError(_("Amount Field can't be empty in case of Dynamic Field Amount Type"))
else:
amount_field = beneficiary_id.mapped(rec.amount_field.name)
if amount_field:
amount_field = amount_field[0] or 0
amount = float(amount_field) * float(multiplier)
else:
amount = rec.amount * float(multiplier)

# Compute the sum of cash entitlements
if beneficiary_id.id in new_entitlements_to_create:
amount = amount + new_entitlements_to_create[beneficiary_id.id]["initial_amount"]
# Check if amount > max_amount; ignore if max_amount is set to 0
if self.max_amount > 0.0 and amount > self.max_amount:
amount = self.max_amount

new_entitlements_to_create[beneficiary_id.id] = {
"cycle_id": cycle.id,
"partner_id": beneficiary_id.id,
"initial_amount": amount,
"currency_id": entitlement_currency,
"state": "draft",
"is_cash_entitlement": True,
"valid_from": entitlement_start_validity,
"valid_until": entitlement_end_validity,
}
# Check if there are additional fields to be added in entitlements
addl_fields = self._get_addl_entitlement_fields(beneficiary_id)
if addl_fields:
new_entitlements_to_create[beneficiary_id.id].update(addl_fields)

# Create entitlement records
for ent in new_entitlements_to_create:
initial_amount = new_entitlements_to_create[ent]["initial_amount"]
new_entitlements_to_create[ent]["initial_amount"] = self._check_subsidy(initial_amount)
if self.inflation_rate and self.enable_inflation:
new_entitlements_to_create[ent]["initial_amount"] = (
new_entitlements_to_create[ent]["initial_amount"] * self.inflation_rate
)

# Create non-zero entitlements only
if new_entitlements_to_create[ent]["initial_amount"] > 0.0:
self.env["g2p.entitlement"].create(new_entitlements_to_create[ent])

def show_approve_entitlements(self, entitlement):
# TODO: Enable the multi-stage entitlement approval
Expand All @@ -42,3 +134,18 @@ class G2PCashEntitlementItem(models.Model):
_inherit = "g2p.program.entitlement.manager.cash.item"

name = fields.Char()

amount_type = fields.Selection(
[("constant", "Constant"), ("dynamic_field", "Dynamic Field")], default="constant", required=True
)
amount_field = fields.Many2one(
"ir.model.fields",
domain=[("model_id.model", "=", "res.partner"), ("ttype", "=", "integer")],
)

@api.onchange("amount_type")
def onchange_amount_type(self):
if self.amount_type == "dynamic_field":
self.amount = 0.0
else:
self.amount_field = None
13 changes: 13 additions & 0 deletions g2p_entitlement_differential/views/entitlement_manager_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,22 @@ Part of OpenG2P. See LICENSE file for full copyright and licensing details.
>
<field name="name" />
</xpath>
<xpath expr="//field[@name='entitlement_item_ids']/tree/field[@name='amount']" position="replace">
<field name="amount_type" />
<field name="amount_field" invisible="amount_type == 'constant'" />
<field name="amount" invisible="amount_type == 'dynamic_field'" />
</xpath>
<xpath expr="//field[@name='entitlement_item_ids']/form/group/field" position="before">
<field name="name" />
</xpath>
<xpath
expr="//field[@name='entitlement_item_ids']/form/group/field[@name='amount']"
position="replace"
>
<field name="amount_type" />
<field name="amount_field" invisible="amount_type == 'constant'" />
<field name="amount" invisible="amount_type == 'dynamic_field'" />
</xpath>
</field>
</record>
</odoo>
2 changes: 1 addition & 1 deletion g2p_payment_g2p_connect/models/payment_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def payments_status_check(self, id_):
}
try:
_logger.info("G2P Connect Disbursement Status Data: %s", status_data)
token = self.create_jwt_token(json.dumps(status_data, separators=(",", ":")))
token = payment_manager.create_jwt_token(json.dumps(status_data, separators=(",", ":")))
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
Expand Down
1 change: 1 addition & 0 deletions g2p_support_desk/models/support_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class SupportTicket(models.Model):
# response_time = fields.Float(
# string="Response Time (Hours)", readonly=True, compute="_compute_response_time", store=True
# )
resolution_message = fields.Html()
resolution_time = fields.Float(string="Resolution Time (Hours)")

def action_assign_to_me(self):
Expand Down
6 changes: 6 additions & 0 deletions g2p_support_desk/views/support_ticket_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@
<page string="Description" name="description">
<field name="description" placeholder="Add a description..." />
</page>
<page string="Resolution" name="resolution">
<group>
<field name="resolution_message" placeholder="Add a resolution..." />
<field name="resolution_time" />
</group>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
Expand Down
4 changes: 2 additions & 2 deletions g2p_theme/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"author": "OpenG2P",
"website": "https://openg2p.org",
"license": "LGPL-3",
"depends": ["base", "web", "auth_signup", "website"],
"depends": ["base", "web", "auth_signup"],
"data": [
"templates/g2p_login_page.xml",
"templates/g2p_reset_password.xml",
Expand All @@ -18,7 +18,7 @@
"g2p_theme/static/src/css/style.css",
],
"web.assets_frontend": [
"g2p_theme/static/src/scss/new_login_page.scss",
"g2p_theme/static/src/scss/g2p_login_page.scss",
],
},
"demo": [],
Expand Down
6 changes: 5 additions & 1 deletion g2p_theme/i18n/g2p_theme.pot
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ msgstr ""

#. module: g2p_theme
#: model_terms:ir.ui.view,arch_db:g2p_theme.g2p_reset_password
#: model_terms:ir.ui.view,arch_db:g2p_theme.login
msgid "Logo"
msgstr ""

Expand All @@ -80,3 +79,8 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:g2p_theme.g2p_reset_password
msgid "Your Email / Username"
msgstr ""

#. module: g2p_theme
#: model_terms:ir.ui.view,arch_db:g2p_theme.login
msgid "organization Logo"
msgstr ""
70 changes: 0 additions & 70 deletions g2p_theme/static/src/scss/assets_menu.scss

This file was deleted.

Loading