Skip to content

Commit

Permalink
Merge branch '17.0-1.2' into 17.0-1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
shibu-narayanan authored Dec 27, 2024
2 parents 2210924 + c72e7c9 commit 816b1ec
Show file tree
Hide file tree
Showing 58 changed files with 211 additions and 308 deletions.
70 changes: 35 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

<!-- /!\ Non OCA Context : Set here the badge of your runbot / runboat instance. -->
[![Pre-commit Status](https://github.com/openg2p/openg2p-program/actions/workflows/pre-commit.yml/badge.svg?branch=17.0-develop)](https://github.com/openg2p/openg2p-program/actions/workflows/pre-commit.yml?query=branch%3A17.0-develop)
[![Build Status](https://github.com/openg2p/openg2p-program/actions/workflows/test.yml/badge.svg?branch=17.0-develop)](https://github.com/openg2p/openg2p-program/actions/workflows/test.yml?query=branch%3A17.0-develop)
[![codecov](https://codecov.io/gh/openg2p/openg2p-program/branch/17.0-develop/graph/badge.svg)](https://codecov.io/gh/openg2p/openg2p-program)
[![Pre-commit Status](https://github.com/openg2p/openg2p-program/actions/workflows/pre-commit.yml/badge.svg?branch=17.0-1.2)](https://github.com/openg2p/openg2p-program/actions/workflows/pre-commit.yml?query=branch%3A17.0-1.2)
[![Build Status](https://github.com/openg2p/openg2p-program/actions/workflows/test.yml/badge.svg?branch=17.0-1.2)](https://github.com/openg2p/openg2p-program/actions/workflows/test.yml?query=branch%3A17.0-1.2)
[![codecov](https://codecov.io/gh/openg2p/openg2p-program/branch/17.0-1.2/graph/badge.svg)](https://codecov.io/gh/openg2p/openg2p-program)
<!-- /!\ Non OCA Context : Set here the badge of your translation instance. -->

<!-- /!\ do not modify above this line -->
Expand All @@ -21,44 +21,44 @@ Available addons
----------------
addon | version | maintainers | summary
--- | --- | --- | ---
[g2p_entitlement_differential](g2p_entitlement_differential/) | 17.0.0.0.0 | | OpenG2P Entitlement: Differential
[g2p_entitlement_in_kind](g2p_entitlement_in_kind/) | 17.0.0.0.0 | | OpenG2P Entitlement: In-Kind
[g2p_entitlement_voucher](g2p_entitlement_voucher/) | 17.0.0.0.0 | | OpenG2P Entitlement: Voucher
[g2p_formio](g2p_formio/) | 17.0.0.0.0 | | Form builders allow you to create, manage, and use dynamic forms with ease.
[g2p_mis_importer](g2p_mis_importer/) | 17.0.0.0.0 | | G2P MIS Importer
[g2p_notifications_base](g2p_notifications_base/) | 17.0.0.0.0 | | G2P Notifications: Base
[g2p_notifications_fast2sms](g2p_notifications_fast2sms/) | 17.0.0.0.0 | | G2P Notifications: Fast2SMS Service Provider
[g2p_notifications_voucher](g2p_notifications_voucher/) | 17.0.0.0.0 | | G2P Notifications: Voucher
[g2p_notifications_wiserv](g2p_notifications_wiserv/) | 17.0.0.0.0 | | G2P Notifications: Wiserv SMS Service Provider
[g2p_odk_importer_program](g2p_odk_importer_program/) | 17.0.0.0.0 | | Import records from ODK and add then into Program
[g2p_openid_vci_programs](g2p_openid_vci_programs/) | 17.0.0.0.0 | | G2P OpenID VCI: Program Beneficiaries
[g2p_payment_cash](g2p_payment_cash/) | 17.0.0.0.0 | | OpenG2P Program Payment: Cash
[g2p_payment_files](g2p_payment_files/) | 17.0.0.0.0 | | OpenG2P Program Payments: In Files
[g2p_payment_g2p_connect](g2p_payment_g2p_connect/) | 17.0.0.0.0 | | OpenG2P Program Payment: G2P Connect Payment Manager
[g2p_payment_interop_layer](g2p_payment_interop_layer/) | 17.0.0.0.0 | | OpenG2P Program Payment (Payment Interoperability Layer)
[g2p_payment_phee](g2p_payment_phee/) | 17.0.0.0.0 | | OpenG2P Program Payment (Payment Hub EE)
[g2p_payment_simple_mpesa](g2p_payment_simple_mpesa/) | 17.0.0.0.0 | | OpenG2P Program Payment: Simple Mpesa Payment Manager
[g2p_program_approval](g2p_program_approval/) | 17.0.0.0.0 | | OpenG2P Program: Approval
[g2p_program_assessment](g2p_program_assessment/) | 17.0.0.0.0 | | OpenG2P Program: Assessment
[g2p_program_autoenrol](g2p_program_autoenrol/) | 17.0.0.0.0 | | OpenG2P Programs: Autoenrol
[g2p_program_cycleless](g2p_program_cycleless/) | 17.0.0.0.0 | | OpenG2P Programs: Cycleless
[g2p_program_documents](g2p_program_documents/) | 17.0.0.0.0 | | OpenG2P Program: Documents
[g2p_program_registrant_info](g2p_program_registrant_info/) | 17.0.0.0.0 | | G2P Program: Registrant Info
[g2p_program_reimbursement](g2p_program_reimbursement/) | 17.0.0.0.0 | | OpenG2P Programs: Reimbursement
[g2p_programs](g2p_programs/) | 17.0.0.0.0 | | OpenG2P Programs
[g2p_proxy_means_test](g2p_proxy_means_test/) | 17.0.0.0.0 | | G2P: Proxy Means Test
[g2p_reimbursement_portal](g2p_reimbursement_portal/) | 17.0.0.0.0 | | G2P Reimbursement Portal
[g2p_social_registry_importer](g2p_social_registry_importer/) | 17.0.0.0.0 | | Import records from Social Registry
[g2p_theme](g2p_theme/) | 17.0.0.0.0 | | OpenG2P Theme
[g2p_entitlement_differential](g2p_entitlement_differential/) | 17.0.1.2.0 | | OpenG2P Entitlement: Differential
[g2p_entitlement_in_kind](g2p_entitlement_in_kind/) | 17.0.1.2.0 | | OpenG2P Entitlement: In-Kind
[g2p_entitlement_voucher](g2p_entitlement_voucher/) | 17.0.1.2.0 | | OpenG2P Entitlement: Voucher
[g2p_formio](g2p_formio/) | 17.0.1.2.0 | | Form builders allow you to create, manage, and use dynamic forms with ease.
[g2p_mis_importer](g2p_mis_importer/) | 17.0.1.2.0 | | G2P MIS Importer
[g2p_notifications_base](g2p_notifications_base/) | 17.0.1.2.0 | | G2P Notifications: Base
[g2p_notifications_fast2sms](g2p_notifications_fast2sms/) | 17.0.1.2.0 | | G2P Notifications: Fast2SMS Service Provider
[g2p_notifications_voucher](g2p_notifications_voucher/) | 17.0.1.2.0 | | G2P Notifications: Voucher
[g2p_notifications_wiserv](g2p_notifications_wiserv/) | 17.0.1.2.0 | | G2P Notifications: Wiserv SMS Service Provider
[g2p_odk_importer_program](g2p_odk_importer_program/) | 17.0.1.2.0 | | Import records from ODK and add then into Program
[g2p_openid_vci_programs](g2p_openid_vci_programs/) | 17.0.1.2.0 | | G2P OpenID VCI: Program Beneficiaries
[g2p_payment_cash](g2p_payment_cash/) | 17.0.1.2.0 | | OpenG2P Program Payment: Cash
[g2p_payment_files](g2p_payment_files/) | 17.0.1.2.0 | | OpenG2P Program Payments: In Files
[g2p_payment_g2p_connect](g2p_payment_g2p_connect/) | 17.0.1.2.0 | | OpenG2P Program Payment: G2P Connect Payment Manager
[g2p_payment_interop_layer](g2p_payment_interop_layer/) | 17.0.1.2.0 | | OpenG2P Program Payment (Payment Interoperability Layer)
[g2p_payment_phee](g2p_payment_phee/) | 17.0.1.2.0 | | OpenG2P Program Payment (Payment Hub EE)
[g2p_payment_simple_mpesa](g2p_payment_simple_mpesa/) | 17.0.1.2.0 | | OpenG2P Program Payment: Simple Mpesa Payment Manager
[g2p_program_approval](g2p_program_approval/) | 17.0.1.2.0 | | OpenG2P Program: Approval
[g2p_program_assessment](g2p_program_assessment/) | 17.0.1.2.0 | | OpenG2P Program: Assessment
[g2p_program_autoenrol](g2p_program_autoenrol/) | 17.0.1.2.0 | | OpenG2P Programs: Autoenrol
[g2p_program_cycleless](g2p_program_cycleless/) | 17.0.1.2.0 | | OpenG2P Programs: Cycleless
[g2p_program_documents](g2p_program_documents/) | 17.0.1.2.0 | | OpenG2P Program: Documents
[g2p_program_registrant_info](g2p_program_registrant_info/) | 17.0.1.2.0 | | G2P Program: Registrant Info
[g2p_program_reimbursement](g2p_program_reimbursement/) | 17.0.1.2.0 | | OpenG2P Programs: Reimbursement
[g2p_programs](g2p_programs/) | 17.0.1.2.0 | | OpenG2P Programs
[g2p_proxy_means_test](g2p_proxy_means_test/) | 17.0.1.2.0 | | G2P: Proxy Means Test
[g2p_social_registry_importer](g2p_social_registry_importer/) | 17.0.1.2.0 | | Import records from Social Registry
[g2p_social_registry_importer](g2p_social_registry_importer/) | 17.0.1.2.0 | | Import records from Social Registry
[g2p_theme](g2p_theme/) | 17.0.1.2.0 | | OpenG2P Theme


Unported addons
---------------
addon | version | maintainers | summary
--- | --- | --- | ---
[g2p_notifications_rest_api](g2p_notifications_rest_api/) | 17.0.0.0.0 (unported) | | G2P Notifications: REST API
[g2p_program_registrant_info_rest_api](g2p_program_registrant_info_rest_api/) | 17.0.0.0.0 (unported) | | G2P Program : Program Registrant Info Rest API
[g2p_programs_rest_api](g2p_programs_rest_api/) | 17.0.0.0.0 (unported) | | G2P Programs: REST API
[g2p_notifications_rest_api](g2p_notifications_rest_api/) | 17.0.1.2.0 (unported) | | G2P Notifications: REST API
[g2p_program_registrant_info_rest_api](g2p_program_registrant_info_rest_api/) | 17.0.1.2.0 (unported) | | G2P Program : Program Registrant Info Rest API
[g2p_programs_rest_api](g2p_programs_rest_api/) | 17.0.1.2.0 (unported) | | G2P Programs: REST API

[//]: # (end addons)

Expand Down
2 changes: 1 addition & 1 deletion g2p_entitlement_differential/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "OpenG2P Entitlement: Differential",
"category": "G2P",
# Part of OpenG2P. See LICENSE file for full copyright and licensing details.
"version": "17.0.0.0.0",
"version": "17.0.1.2.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
1 change: 0 additions & 1 deletion g2p_entitlement_differential/readme/DESCRIPTION.rst

This file was deleted.

2 changes: 1 addition & 1 deletion g2p_entitlement_in_kind/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "OpenG2P Entitlement: In-Kind",
"category": "G2P",
"version": "17.0.0.0.0",
"version": "17.0.1.2.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
1 change: 0 additions & 1 deletion g2p_entitlement_in_kind/readme/DESCRIPTION.rst

This file was deleted.

2 changes: 1 addition & 1 deletion g2p_entitlement_voucher/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "OpenG2P Entitlement: Voucher",
"category": "G2P",
"version": "17.0.0.0.0",
"version": "17.0.1.2.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_formio/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "OpenG2P Formio",
"category": "G2P",
"version": "17.0.0.0.0",
"version": "17.0.1.2.0",
"sequence": 1,
"summary": "Form builders allow you to create, manage, and use dynamic forms with ease.",
"author": "OpenG2P",
Expand Down
12 changes: 11 additions & 1 deletion g2p_formio/i18n/g2p_formio.pot
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ msgstr ""
msgid "Create a New Program Wizard"
msgstr ""

#. module: g2p_formio
#: model:ir.model,name:g2p_formio.model_formio_builder
msgid "Form Builder"
msgstr ""

#. module: g2p_formio
#: model:ir.model.fields,field_description:g2p_formio.field_formio_builder__is_form_mapped_with_program
msgid "Is Form Mapped"
msgstr ""

#. module: g2p_formio
#: model:ir.model.fields,field_description:g2p_formio.field_g2p_program__is_multiple_form_submission
#: model:ir.model.fields,field_description:g2p_formio.field_g2p_program_create_wizard__is_multiple_form_submission
Expand All @@ -36,7 +46,7 @@ msgid "Program"
msgstr ""

#. module: g2p_formio
#: model:ir.model.fields,field_description:g2p_formio.field_g2p_program__self_service_portal_form
#: model:ir.model.fields,field_description:g2p_formio.field_g2p_program__portal_form_builder_id
#: model:ir.model.fields,field_description:g2p_formio.field_g2p_program_create_wizard__self_service_portal_form
msgid "Program Form"
msgstr ""
Expand Down
55 changes: 53 additions & 2 deletions g2p_formio/models/program.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,60 @@
from odoo import fields, models
import json

from odoo import api, fields, models


class G2PProgram(models.Model):
_inherit = "g2p.program"

self_service_portal_form = fields.Many2one("formio.builder", string="Program Form")
portal_form_builder_id = fields.Many2one(
"formio.builder", string="Program Form", domain="[('is_form_mapped_with_program', '=', False)]"
)

is_multiple_form_submission = fields.Boolean(default=False)

@api.constrains("portal_form_builder_id")
def _constrain_portal_form_mapping(self):
self.ensure_one()

if self.portal_form_builder_id:
formio_builder = self.portal_form_builder_id

try:
# Parse the JSON string into a dictionary
js_options = json.loads(formio_builder.formio_js_options)

if "editForm" in js_options and "file" in js_options["editForm"]:
file_components = js_options["editForm"]["file"][0]["components"]

for component in file_components:
if "defaultValue" in component and component["key"] == "url":
component["defaultValue"] = f"/v1/selfservice/uploadDocument/{self.id}"

# Convert back to JSON string and update the builder
formio_builder.write(
{
"formio_js_options": json.dumps(js_options, indent=4),
"is_form_mapped_with_program": True,
}
)
else:
formio_builder.write({"is_form_mapped_with_program": False})

except (json.JSONDecodeError, KeyError, IndexError):
# Handle potential JSON parsing errors or missing keys
formio_builder.write({"is_form_mapped_with_program": False})

@api.onchange("portal_form_builder_id")
def _onchange_portal_form_unmapping(self):
# Check if there was a previous form that is now being removed
previous_form = self._origin.portal_form_builder_id
current_form = self.portal_form_builder_id

if previous_form and not current_form:
previous_form.write({"is_form_mapped_with_program": False})


class G2PProgramFomio(models.Model):
_inherit = "formio.builder"

is_form_mapped_with_program = fields.Boolean(string="Is Form Mapped", default=False)
7 changes: 5 additions & 2 deletions g2p_formio/views/formio_builder.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<xpath expr="//group[@name='publish_settings']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//group[@name='other_settings']" position="attributes">
<attribute name="invisible">1</attribute>
<xpath expr="//group[@name='other_settings']" position="inside">
<field name="is_form_mapped_with_program" invisible="1" />
</xpath>
<!-- <xpath expr="//group[@name='formiojs_settings']" position="attributes">
<attribute name="invisible">1</attribute>
Expand All @@ -48,6 +48,9 @@
<field name="formio_version_id" position="attributes">
<attribute name="column_invisible">1</attribute>
</field>
<field name="name" position="after">
<field name="is_form_mapped_with_program" column_invisible="0" />
</field>
</data>
</field>
</record>
Expand Down
2 changes: 1 addition & 1 deletion g2p_formio/views/program_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Part of OpenG2P. See LICENSE file for full copyright and licensing details.
<page string="Portal Form">
<group>
<field name="is_multiple_form_submission" />
<field name="self_service_portal_form" />
<field name="portal_form_builder_id" />
</group>
</page>
</xpath>
Expand Down
2 changes: 1 addition & 1 deletion g2p_mis_importer/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "G2P MIS Importer",
"category": "G2P",
"version": "17.0.0.0.0",
"version": "17.0.1.2.0",
"author": "OpenG2P",
"website": "https://openg2p.org",
"license": "LGPL-3",
Expand Down
2 changes: 1 addition & 1 deletion g2p_notifications_base/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "G2P Notifications: Base",
"category": "G2P",
"version": "17.0.0.0.0",
"version": "17.0.1.2.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_notifications_fast2sms/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "G2P Notifications: Fast2SMS Service Provider",
"category": "G2P",
"version": "17.0.0.0.0",
"version": "17.0.1.2.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_notifications_rest_api/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "G2P Notifications: REST API",
"category": "G2P",
"version": "17.0.0.0.0",
"version": "17.0.1.2.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_notifications_voucher/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "G2P Notifications: Voucher",
"category": "G2P",
"version": "17.0.0.0.0",
"version": "17.0.1.2.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_notifications_wiserv/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "G2P Notifications: Wiserv SMS Service Provider",
"category": "G2P",
"version": "17.0.0.0.0",
"version": "17.0.1.2.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_odk_importer_program/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "G2P ODK Importer: Program",
"category": "Connector",
"summary": "Import records from ODK and add then into Program",
"version": "17.0.0.0.0",
"version": "17.0.1.2.0",
"sequence": 3,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
9 changes: 2 additions & 7 deletions g2p_odk_importer_program/i18n/g2p_odk_importer_program.pot
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ msgid "ODK Import"
msgstr ""

#. module: g2p_odk_importer_program
#: model:ir.model.fields,field_description:g2p_odk_importer_program.field_odk_import__program
msgid "Program"
msgstr ""

#. module: g2p_odk_importer_program
#: model_terms:ir.ui.view,arch_db:g2p_odk_importer_program.view_program_odk_config_form
msgid "Program details"
#: model:ir.model.fields,field_description:g2p_odk_importer_program.field_odk_import__target_program
msgid "Target Program"
msgstr ""
2 changes: 1 addition & 1 deletion g2p_odk_importer_program/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Part of Newlogic G2P. See LICENSE file for full copyright and licensing details.

from . import odk_client
from . import odk_config
from . import odk_import
19 changes: 10 additions & 9 deletions g2p_odk_importer_program/models/odk_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@


def patched_addl_data(self, mapped_json):
config = self.env["odk.config"].browse(self.id)
odk_import = self.env["odk.import"].browse(self.id)

program_id = config.program.id

if "program_registrant_info_ids" in mapped_json:
prog_reg_info = mapped_json.get("program_registrant_info_ids", None)

if not program_id:
del mapped_json["program_registrant_info_ids"]
return mapped_json
program_id = odk_import.target_program.id

if program_id:
mapped_json["program_membership_ids"] = [
(
0,
Expand All @@ -27,6 +21,13 @@ def patched_addl_data(self, mapped_json):
)
]

if "program_registrant_info_ids" in mapped_json:
prog_reg_info = mapped_json.get("program_registrant_info_ids", None)

if not program_id:
del mapped_json["program_registrant_info_ids"]
return mapped_json

mapped_json["program_registrant_info_ids"] = [
(
0,
Expand Down
7 changes: 0 additions & 7 deletions g2p_odk_importer_program/models/odk_config.py

This file was deleted.

12 changes: 12 additions & 0 deletions g2p_odk_importer_program/models/odk_import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from odoo import api, fields, models


class OdkImport(models.Model):
_inherit = "odk.import"

target_program = fields.Many2one("g2p.program", domain="[('target_type', '=', target_registry)]")

@api.onchange("target_registry")
def onchange_target_registry(self):
for rec in self:
rec.target_program = None
6 changes: 2 additions & 4 deletions g2p_odk_importer_program/views/odk_import_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
<field name="model">odk.import</field>
<field name="inherit_id" ref="g2p_odk_importer.view_odk_import_form" />
<field name="arch" type="xml">
<xpath expr="//sheet" position="inside">
<group string="Program details">
<field name="program" />
</group>
<xpath expr="//field[@name='target_registry']" position="after">
<field name="target_program" />
</xpath>
</field>
</record>
Expand Down
Loading

0 comments on commit 816b1ec

Please sign in to comment.