Skip to content

Commit

Permalink
Fixed precommit errors. Removed rest api modules
Browse files Browse the repository at this point in the history
Signed-off-by: Lalith Kota <[email protected]>
  • Loading branch information
lalithkota committed Apr 2, 2024
1 parent 8266418 commit fdce090
Show file tree
Hide file tree
Showing 17 changed files with 55 additions and 54 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
exclude: |
(?x)
# NOT INSTALLABLE ADDONS
^g2p_notifications_rest_api/|
# END NOT INSTALLABLE ADDONS
# Files and folders generated by bots, to avoid loops
^setup/|/static/description/index\.html$|
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@ addon | version | maintainers | summary
--- | --- | --- | ---
[g2p_notifications_base](g2p_notifications_base/) | 17.0.1.0.0 | | G2P Notifications: Base
[g2p_notifications_fast2sms](g2p_notifications_fast2sms/) | 17.0.1.0.0 | | G2P Notifications: Fast2SMS Service Provider
[g2p_notifications_rest_api](g2p_notifications_rest_api/) | 17.0.1.0.0 | | G2P Notifications: REST API
[g2p_notifications_voucher](g2p_notifications_voucher/) | 17.0.1.0.0 | | G2P Notifications: Voucher
[g2p_notifications_wiserv](g2p_notifications_wiserv/) | 17.0.1.0.0 | | G2P Notifications: Wiserv SMS Service Provider


Unported addons
---------------
addon | version | maintainers | summary
--- | --- | --- | ---
[g2p_notifications_rest_api](g2p_notifications_rest_api/) | 17.0.1.0.0 (unported) | | G2P Notifications: REST API

[//]: # (end addons)

<!-- prettier-ignore-end -->
Expand Down
10 changes: 8 additions & 2 deletions g2p_notifications_base/models/payment_manager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

from odoo import models
from odoo import fields, models

from odoo.addons.g2p_programs.models import constants

Expand All @@ -11,9 +11,15 @@ class DefaultPaymentManager(models.Model):
_inherit = "g2p.program.payment.manager.default"

def send_payments(self, batches):
res = super(DefaultPaymentManager, self).send_payments(batches)
res = super().send_payments(batches)
if res and batches:
for manager in self.program_id.get_managers(constants.MANAGER_NOTIFICATION):
for batch in batches:
manager.on_payment_send(batch)
return res


class G2PPayment(models.Model):
_inherit = "g2p.payment"

is_payment_notification_sent = fields.Boolean(default=False)
6 changes: 4 additions & 2 deletions g2p_notifications_base/models/program_membership.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from odoo import models
from odoo import fields, models

from odoo.addons.g2p_programs.models import constants


class G2PProgramMembership(models.Model):
_inherit = "g2p.program_membership"

is_enrolled_notification_sent = fields.Boolean(default=False)

def enroll_eligible_registrants(self):
res = super(G2PProgramMembership, self).enroll_eligible_registrants()
res = super().enroll_eligible_registrants()
if res and res.get("params", {}).get("type", None) == "success":
for manager in self.program_id.get_managers(constants.MANAGER_NOTIFICATION):
manager.on_enrolled_in_program(self)
Expand Down
12 changes: 0 additions & 12 deletions g2p_notifications_base/models/registrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,3 @@ def _default_notification_preference(self):
],
default=_default_notification_preference,
)


class G2PProgramMembership(models.Model):
_inherit = "g2p.program_membership"

is_enrolled_notification_sent = fields.Boolean(default=False)


class G2PPayment(models.Model):
_inherit = "g2p.payment"

is_payment_notification_sent = fields.Boolean(default=False)
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
/>
</h2>
</div>
<group string="TEMPLATES">
<group name="notification_templates" string="TEMPLATES">
<field name="on_enrolled_in_program_template" />
<field name="on_cycle_started_template" />
<field name="on_cycle_ended_template" />
Expand Down
4 changes: 2 additions & 2 deletions g2p_notifications_base/views/sms_notification_manager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<field name="inherit_id" ref="g2p_programs.view_notification_manager_sms_form" />
<field name="priority">100</field>
<field name="arch" type="xml">
<xpath expr="//group[contains(text(), TEMPLATES)]" position="replace">
<group string="TEMPLATES">
<xpath expr="//field[@name='on_enrolled_in_program_template']/../../.." position="replace">
<group name="notification_templates" string="TEMPLATES">
<field name="on_enrolled_in_program_template" />
<field name="on_cycle_started_template" />
<field name="on_cycle_ended_template" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ def send_sms(self, phone, body):
headers={
"authorization": self.access_token,
},
timeout=15,
)
return response.text
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
<xpath expr="//form" position="attributes">
<attribute name="name">Fast2SMS Notification Manager</attribute>
</xpath>
<xpath expr="//group[contains(text(), TEMPLATES)]" position="after">
<group string="Settings">
<group name="notification_templates" position="after">
<group name="settings" string="Settings">
<field name="send_api_endpoint" />
<field name="access_token" password="True" />
<field name="sms_language" />
<field name="sms_route" />
</group>
</xpath>
</group>
</field>
</record>

Expand Down
2 changes: 1 addition & 1 deletion g2p_notifications_rest_api/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"demo": [],
"images": [],
"application": False,
"installable": True,
"installable": False,
"auto_install": False,
}
2 changes: 1 addition & 1 deletion g2p_notifications_rest_api/services/process_group_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class ProcessGroupMixin(AbstractComponent):
_inherit = "process_group.rest.mixin"

def _process_group(self, group_info):
res = super(ProcessGroupMixin, self)._process_group(group_info)
res = super()._process_group(group_info)
if group_info.dict().get("notification_preference", None):
res["notification_preference"] = group_info.notification_preference
return res
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class ProcessIndividualMixin(AbstractComponent):
_inherit = "process_individual.rest.mixin"

def _process_individual(self, individual):
res = super(ProcessIndividualMixin, self)._process_individual(individual)
res = super()._process_individual(individual)
if individual.dict().get("notification_preference", None):
res["notification_preference"] = individual.notification_preference
return res
4 changes: 1 addition & 3 deletions g2p_notifications_voucher/models/entitlement_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ class G2PVoucherEntitlementManagerNotification(models.Model):
_inherit = "g2p.program.entitlement.manager.voucher"

def _generate_vouchers(self, entitlements):
err_count, files = super(G2PVoucherEntitlementManagerNotification, self)._generate_vouchers(
entitlements
)
err_count, files = super()._generate_vouchers(entitlements)
notif_managers = self.program_id.get_managers(constants.MANAGER_NOTIFICATION)
for notif_manager in notif_managers:
notif_manager.on_generate_voucher(entitlements)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<field name="model">g2p.program.notification.manager.email</field>
<field name="inherit_id" ref="g2p_notifications_base.view_notification_manager_email_form" />
<field name="arch" type="xml">
<xpath expr="//group[contains(text(), TEMPLATES)]" position="inside">
<group name="notification_templates" position="inside">
<field name="on_generate_voucher_template" />
</xpath>
</group>
</field>
</record>
</odoo>
4 changes: 2 additions & 2 deletions g2p_notifications_voucher/views/sms_notification_manager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<field name="model">g2p.program.notification.manager.sms</field>
<field name="inherit_id" ref="g2p_notifications_base.view_notification_manager_sms_inherit_form" />
<field name="arch" type="xml">
<xpath expr="//group[contains(text(), TEMPLATES)]" position="inside">
<group name="notification_templates" position="inside">
<field name="on_generate_voucher_template" />
</xpath>
</group>
</field>
</record>
</odoo>
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
<xpath expr="//form" position="attributes">
<attribute name="name">Wiservsms Notification Manager</attribute>
</xpath>
<xpath expr="//group[contains(text(), TEMPLATES)]" position="after">
<group string="Settings">
<field name="api_url" required="True" />
<field name="user_name" required="True" />
<field name="wiserv_password" password="True" required="True" />
</group>
</xpath>
<group name="notification_templates" position="after">
<group name="settings" string="Settings">
<field name="api_url" required="True" />
<field name="user_name" required="True" />
<field name="wiserv_password" password="True" required="True" />
</group>
</group>
<xpath expr="//sheet" position="after">
<div class="oe_chatter">
<field name="message_follower_ids" />
Expand Down
27 changes: 13 additions & 14 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
git+https://github.com/OpenG2P/[email protected]#subdirectory=setup/g2p_json_field
git+https://github.com/OpenG2P/[email protected]#subdirectory=setup/g2p_documents
git+https://github.com/OpenG2P/[email protected]#subdirectory=setup/g2p_registry_base
git+https://github.com/OpenG2P/[email protected]#subdirectory=setup/g2p_registry_individual
git+https://github.com/OpenG2P/[email protected]#subdirectory=setup/g2p_registry_group
git+https://github.com/OpenG2P/[email protected]#subdirectory=setup/g2p_registry_membership
git+https://github.com/OpenG2P/[email protected]#subdirectory=setup/g2p_registry_rest_api
git+https://github.com/OpenG2P/[email protected]#subdirectory=setup/g2p_bank
git+https://github.com/OpenG2P/[email protected]#subdirectory=setup/g2p_bank_rest_api
git+https://github.com/OpenG2P/[email protected]#subdirectory=setup/g2p_programs
git+https://github.com/OpenG2P/[email protected]#subdirectory=setup/g2p_program_documents
git+https://github.com/OpenG2P/[email protected]#subdirectory=setup/g2p_payment_files
git+https://github.com/OpenG2P/[email protected]#subdirectory=setup/g2p_programs_rest_api
git+https://github.com/OpenG2P/[email protected]#subdirectory=setup/g2p_entitlement_voucher
git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_documents
git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_registry_base
git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_registry_individual
git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_registry_group
git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_registry_membership
# git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_registry_rest_api
git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_bank
# git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_bank_rest_api
git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_programs
git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_program_documents
git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_payment_files
# git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_programs_rest_api
git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_entitlement_voucher

0 comments on commit fdce090

Please sign in to comment.