Skip to content

Commit

Permalink
G2P-1640: g2p_program module migrated to odoo17
Browse files Browse the repository at this point in the history
  • Loading branch information
dibik96 committed Jan 2, 2024
1 parent f4d9647 commit 5a503cf
Show file tree
Hide file tree
Showing 50 changed files with 259 additions and 312 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ github_enable_makepot: true
github_enable_stale_action: true
github_enforce_dev_status_compatibility: false
include_wkhtmltopdf: false
odoo_version: 15.0
odoo_version: 17.0
org_name: OpenG2P
org_slug: openg2p
rebel_module_groups: []
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ repos:
- --addons-dir=.
- --org-name=openg2p
- --repo-name=openg2p-program
- --branch=15.0
- --branch=17.0
stages: [manual]
- id: oca-gen-addons-table
stages: [manual]
Expand Down
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ manifest_required_authors=OpenG2P
manifest_required_keys=license
manifest_deprecated_keys=description,active
license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3,Other OSI approved licence
valid_odoo_versions=15.0
valid_odoo_versions=17.0

[MESSAGES CONTROL]
disable=all
Expand Down
2 changes: 1 addition & 1 deletion .pylintrc-mandatory
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ manifest_required_authors=OpenG2P
manifest_required_keys=license
manifest_deprecated_keys=description,active
license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3,Other OSI approved licence
valid_odoo_versions=15.0
valid_odoo_versions=17.0

[MESSAGES CONTROL]
disable=all
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": "15.0.1.2.0",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
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": "15.0.1.1.0",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
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": "15.0.1.2.0",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_payment_cash/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "OpenG2P Program Payment: Cash",
"category": "G2P",
"version": "15.0.1.2.0",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_payment_files/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "OpenG2P Program Payments: In Files",
"category": "G2P",
"version": "15.0.1.2.0",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_payment_g2p_connect/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "OpenG2P Program Payment: G2P Connect Payment Manager",
"category": "G2P",
"version": "15.0.1.2.0",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_payment_interop_layer/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "OpenG2P Program Payment (Payment Interoperability Layer)",
"category": "G2P",
"version": "15.0.1.2.0",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_payment_phee/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "OpenG2P Program Payment (Payment Hub EE)",
"category": "G2P",
"version": "15.0.1.2.0",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_payment_simple_mpesa/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "OpenG2P Program Payment: Simple Mpesa Payment Manager",
"category": "G2P",
"version": "15.0.1.2.0",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_program_approval/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "OpenG2P Program: Approval",
"category": "G2P",
"version": "15.0.1.2.0",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_program_assessment/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "OpenG2P Program: Assessment",
"category": "G2P",
"version": "15.0.1.2.0",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_program_autoenrol/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "OpenG2P Programs: Autoenrol",
"category": "G2P",
"version": "15.0.1.2.0",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_program_cycleless/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "OpenG2P Programs: Cycleless",
"category": "G2P",
"version": "15.0.1.2.0",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_program_documents/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "OpenG2P Program: Documents",
"category": "G2P",
"version": "15.0.1.2.0",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_program_registrant_info/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "G2P Program: Registrant Info",
"category": "G2P",
"version": "15.0.1.2.0",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_program_registrant_info_rest_api/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "G2P Program : Program Registrant Info Rest API",
"category": "G2P",
"version": "15.0.1.2.0",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
2 changes: 1 addition & 1 deletion g2p_program_reimbursement/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "OpenG2P Programs: Reimbursement",
"category": "G2P",
"version": "15.0.1.2.0",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand Down
14 changes: 7 additions & 7 deletions g2p_programs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ OpenG2P Programs
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:fb0ff7f1c97d52e7764e1016144cdf00aedf9be445aa4fa1d022910e2bc709d6
!! source digest: sha256:573945622736e514132332b73cbceb4910c794fa68f9f53e2ef40f955acd038a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/github-OpenG2P%2Fopeng2p--program-lightgray.png?logo=github
:target: https://github.com/OpenG2P/openg2p-program/tree/15.0-develop/g2p_programs
:alt: OpenG2P/openg2p-program
.. |badge2| image:: https://img.shields.io/badge/github-OpenG2P%2Fopeng2p--programs-lightgray.png?logo=github
:target: https://github.com/OpenG2P/openg2p-programs/tree/17.0-develop/g2p_programs
:alt: OpenG2P/openg2p-programs

|badge1| |badge2|

Expand Down Expand Up @@ -45,10 +45,10 @@ Features
Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OpenG2P/openg2p-program/issues>`_.
Bugs are tracked on `GitHub Issues <https://github.com/OpenG2P/openg2p-programs/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OpenG2P/openg2p-program/issues/new?body=module:%20g2p_programs%0Aversion:%2015.0-develop%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OpenG2P/openg2p-programs/issues/new?body=module:%20g2p_programs%0Aversion:%2017.0-develop%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand All @@ -74,6 +74,6 @@ Contributors include:
Maintainers
~~~~~~~~~~~

This module is part of the `OpenG2P/openg2p-program <https://github.com/OpenG2P/openg2p-program/tree/15.0-develop/g2p_programs>`_ project on GitHub.
This module is part of the `OpenG2P/openg2p-programs <https://github.com/OpenG2P/openg2p-programs/tree/17.0-develop/g2p_programs>`_ project on GitHub.

You are welcome to contribute.
8 changes: 4 additions & 4 deletions g2p_programs/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "OpenG2P Programs",
"category": "G2P/G2P",
"version": "15.0.1.2.0",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
Expand All @@ -16,7 +16,7 @@
"g2p_registry_group",
"g2p_registry_membership",
"g2p_bank",
"l10n_generic_coa",
# "l10n_generic_coa",
"event_sms",
"calendar",
"queue_job",
Expand Down Expand Up @@ -58,11 +58,11 @@
],
"assets": {
"web.assets_backend": [
"/g2p_programs/static/src/js/create_program.js",
# "/g2p_programs/static/src/js/create_program.js",
"/g2p_programs/static/src/css/style.css",
],
"web.assets_qweb": [
"/g2p_programs/static/src/xml/create_program_template.xml",
# "/g2p_programs/static/src/xml/create_program_template.xml",
],
},
"demo": [],
Expand Down
15 changes: 6 additions & 9 deletions g2p_programs/models/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,16 @@ class G2PCycle(models.Model):
STATE_ENDED = constants.STATE_ENDED
DISABLE_EDIT_DOMAIN = [("state", "!=", "draft")]

def fields_view_get(
self, view_id=None, view_type="form", toolbar=False, submenu=False
):
res = super(G2PCycle, self).fields_view_get(
view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu
)
def _get_view(self, view_id=None, view_type="form", **options):
arch, view = super()._get_view(view_id, view_type, **options)

if view_type == "form":
# FIX: 'hide_cash' context is not set when form is loaded directly
# via copy+paste URL in browser.
# Set all payment management components to invisible
# if the form was loaded directly via URL.
if "hide_cash" not in self._context:
doc = etree.XML(res["arch"])
doc = etree.XML(arch)
modifiers = json.dumps({"invisible": True})

prepare_payment_button = doc.xpath("//button[@name='prepare_payment']")
Expand All @@ -63,8 +59,9 @@ def fields_view_get(
payment_batches_page = doc.xpath("//page[@name='payment_batches']")
payment_batches_page[0].set("modifiers", modifiers)

res["arch"] = etree.tostring(doc, encoding="unicode")
return res
arch = etree.tostring(doc, encoding="unicode")

return arch, view

name = fields.Char(required=True)
company_id = fields.Many2one("res.company", default=lambda self: self.env.company)
Expand Down
6 changes: 3 additions & 3 deletions g2p_programs/models/cycle_membership.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ class G2PCycleMembership(models.Model):
),
]

def name_get(self):
res = super(G2PCycleMembership, self).name_get()
def _compute_display_name(self):
res = super()._compute_display_name()
for rec in self:
name = ""
if rec.cycle_id:
name += "[" + rec.cycle_id.name + "] "
if rec.partner_id:
name += rec.partner_id.name
res.append((rec.id, name))
rec.display_name = name
return res

def open_cycle_membership_form(self):
Expand Down
11 changes: 4 additions & 7 deletions g2p_programs/models/entitlement.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,9 @@ def _generate_code(self):
),
]

def fields_view_get(
self, view_id=None, view_type="list", toolbar=False, submenu=False
):
res = super(G2PEntitlement, self).fields_view_get(
view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu
)
@api.model
def _get_view(self, view_id=None, view_type="form", **options):
arch, view = super()._get_view(view_id, view_type, **options)

group_g2p_admin = self.env.user.has_group("g2p_registry_base.group_g2p_admin")
if not group_g2p_admin:
Expand All @@ -132,7 +129,7 @@ def fields_view_get(
_("You have no access in the Entitlement List View")
)

return res
return arch, view

def _compute_name(self):
for record in self:
Expand Down
18 changes: 8 additions & 10 deletions g2p_programs/models/program_membership.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,14 @@ def _compute_enrolled_date(self):
if rec.state == "enrolled":
rec.enrollment_date = fields.Datetime.now()

def fields_view_get(
self, view_id=None, view_type="form", toolbar=False, submenu=False
):
@api.model
def _get_view(self, view_id=None, view_type="form", **options):
context = self.env.context
result = super(G2PProgramMembership, self).fields_view_get(
view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu
)
arch, view = super()._get_view(view_id, view_type, **options)

if view_type == "form":
update_arch = False
doc = etree.XML(result["arch"])
doc = etree.XML(arch)

# Check if we need to change the partner_id domain filter
target_type = context.get("target_type", False)
Expand All @@ -113,8 +111,8 @@ def fields_view_get(
node.set("domain", domain)

if update_arch:
result["arch"] = etree.tostring(doc, encoding="unicode")
return result
arch = etree.tostring(doc, encoding="unicode")
return arch, view

def name_get(self):
res = super(G2PProgramMembership, self).name_get()
Expand All @@ -124,7 +122,7 @@ def name_get(self):
name += "[" + rec.program_id.name + "] "
if rec.partner_id:
name += rec.partner_id.name
res.append((rec.id, name))
rec.display_name = name
return res

def open_beneficiaries_form(self):
Expand Down
Loading

0 comments on commit 5a503cf

Please sign in to comment.