From 81009d16c65b76a7820f6f5d9efebefc07200a9f Mon Sep 17 00:00:00 2001 From: Daniel Gergely Date: Wed, 25 Feb 2026 16:07:41 +0100 Subject: [PATCH 1/6] [T3022] REFACTOR: new partner_segment_link model to replace hard coded personalized_links - REFACTOR: segmentation data now uses the new model-links - CHORE: added partner_segment_link to imports - REFACTOR: removed personalized links and added link_ids - FEAT: created ResPartnerSegmentLink model - REFACTOR: added access rules to new model - REFACTOR: updated partner_segmentation_view to display new links --- .../data/partner_segmentation_data.xml | 422 +++--------------- partner_segmentation/models/__init__.py | 1 + .../models/partner_segment.py | 9 +- .../models/partner_segment_link.py | 43 ++ .../security/ir.model.access.csv | 1 + .../views/partner_segmentation_view.xml | 9 +- 6 files changed, 113 insertions(+), 372 deletions(-) create mode 100644 partner_segmentation/models/partner_segment_link.py diff --git a/partner_segmentation/data/partner_segmentation_data.xml b/partner_segmentation/data/partner_segmentation_data.xml index ae06e9991..6883b82e1 100644 --- a/partner_segmentation/data/partner_segmentation_data.xml +++ b/partner_segmentation/data/partner_segmentation_data.xml @@ -15,50 +15,14 @@ >Did you know? We guarantee that at least 80% of sponsorship donations - for gifts to your sponsored child and fund donations up to 100% - are invested in projects and programmes in the countries of the South. Thank you for the considerable impact you’ve already made.

Thank you for your precious support.

- -
-
-
Why not take a look at our latest updates?
- -
-
-
Take a look at Compassion’s finances
- -
-
-
+ Movement Mobilizers @@ -73,116 +37,20 @@ >We are thrilled about your determination to fight injustices. We are so happy to count you as part of the growing number of people who are joining us in the fight against extreme poverty. We commit to providing platforms where you can advocate for children in need and the fight against extreme poverty and inspire others to join you.

Thank you for your precious support.

- -
-
-
Join or create a project to raise help for the children in need
- TOGETHER -
-
-
Take a look at our latest updates
- -
-
-
Follow us on the social medias
- - -
+ Compassionate Caregivers @@ -199,80 +67,17 @@ Thanks to our holistic approach to child development, we commit to a personal an >You can join us by making a spiritual impact in the lives of children in need through prayer and even get children in your surroundings involved in this endeavour.

Thank you for your precious support.

- -
-
-
Support one of our funds
- -
-
-
Get future generations involved in the fight against extreme poverty
- -
-
-
Take a look at our latest updates
- -
-
-
Watch our latest videos
- Compassion Videos -
-
-
+ Hands-On Helpers @@ -301,50 +106,14 @@ Thanks to our holistic approach to child development, we commit to a personal an

Thank you for your precious support.

- -
- -
-
Take a look at our latest updates
- -
-
-
+ Curious Novices @@ -360,103 +129,16 @@ Thanks to our holistic approach to child development, we commit to a personal an

You can engage with us in flexible and manifold ways.

Thank you for your precious support.

- -
-
-
Support one of our funds
- -
-
-
Why not take a look at our latest updates?
- -
-
-
Follow us on the social medias
- -
+ diff --git a/partner_segmentation/models/__init__.py b/partner_segmentation/models/__init__.py index c389bbda8..3818604fe 100644 --- a/partner_segmentation/models/__init__.py +++ b/partner_segmentation/models/__init__.py @@ -11,6 +11,7 @@ parter_segment_affinity, partner_compassion, partner_segment, + partner_segment_link, survey, survey_user_input, ) diff --git a/partner_segmentation/models/partner_segment.py b/partner_segmentation/models/partner_segment.py index 3a7c84f7b..95f71100d 100644 --- a/partner_segmentation/models/partner_segment.py +++ b/partner_segmentation/models/partner_segment.py @@ -32,7 +32,14 @@ class ResPartnerSegment(models.Model): ) survey_result = fields.Html(translate=True, sanitize=False) - personalized_links = fields.Html(translate=True, sanitize=False) + + link_ids = fields.One2many( + "res.partner.segment.link", + "category_id", + string="Personalized Links", + help="Useful resources for partners in this segment" + ) + image = fields.Binary(help="segment illustration") primary_partners_ids = fields.One2many( diff --git a/partner_segmentation/models/partner_segment_link.py b/partner_segmentation/models/partner_segment_link.py new file mode 100644 index 000000000..718837890 --- /dev/null +++ b/partner_segmentation/models/partner_segment_link.py @@ -0,0 +1,43 @@ +############################################################################## +# +# Copyright (C) 2026 Compassion CH (http://www.compassion.ch) +# Releasing children from poverty in Jesus' name +# @author: Daniel Gergely +# +# The licence is in the file __manifest__.py +# +############################################################################## +from odoo import fields, models + +class ResPartnerSegmentLink(models.Model): + """ + Model to store the + - URL + - Label + - Language + - Category + of a partner segmentation link, which then can be used to + provide useful links to the partners based on their segmentation + category and language. + """ + _name = "res.partner.segment.link" + _description = "Partner Segmentation Link" + + url = fields.Char( + required=True, + help="URL of the link to be provided to the partner" + ) + label = fields.Char( + required=True, + help="Label of the link to be provided to the partner" + ) + language_id = fields.Many2one( + "res.lang", + string="Language", + help="Language of the link, used to provide the link to the partner based on their language" + ) + category_id = fields.Many2one( + "res.partner.segment", + string="Category", + help="Segmentation category of the link, used to provide the link to the partner based on their segmentation category" + ) \ No newline at end of file diff --git a/partner_segmentation/security/ir.model.access.csv b/partner_segmentation/security/ir.model.access.csv index c5d2a3423..4fd5528db 100644 --- a/partner_segmentation/security/ir.model.access.csv +++ b/partner_segmentation/security/ir.model.access.csv @@ -4,3 +4,4 @@ full_access_partner_segmentation, Full access on partner segmentation,model_res_ read_access_partner_segmentation_affinity, Read access on partner segmentation affinity,model_res_partner_segment_affinity,base.group_user,1,0,0,0 read_access_partner_segmentation_affinity_portal, Read access on partner segmentation affinity,model_res_partner_segment_affinity,base.group_portal,1,0,0,0 full_access_partner_segmentation_affinity, Full access on partner segmentation affinity,model_res_partner_segment_affinity,base.group_system,1,1,1,1 +access_res_partner_segment_link_admin,res.partner.segment.link.admin,model_res_partner_segment_link,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/partner_segmentation/views/partner_segmentation_view.xml b/partner_segmentation/views/partner_segmentation_view.xml index fde005b37..770075489 100644 --- a/partner_segmentation/views/partner_segmentation_view.xml +++ b/partner_segmentation/views/partner_segmentation_view.xml @@ -22,7 +22,14 @@ - + + + + + + + + From 7c7c489bc30930af32535085110693514b8796a3 Mon Sep 17 00:00:00 2001 From: Daniel Gergely Date: Thu, 26 Feb 2026 10:02:53 +0100 Subject: [PATCH 2/6] [T3022] STYLE: pre-commit --- .../data/partner_segmentation_data.xml | 35 +++++++++++++------ .../models/partner_segment.py | 2 +- .../models/partner_segment_link.py | 14 ++++---- .../security/ir.model.access.csv | 2 +- .../views/partner_segmentation_view.xml | 8 ++--- 5 files changed, 38 insertions(+), 23 deletions(-) diff --git a/partner_segmentation/data/partner_segmentation_data.xml b/partner_segmentation/data/partner_segmentation_data.xml index 6883b82e1..db6489f09 100644 --- a/partner_segmentation/data/partner_segmentation_data.xml +++ b/partner_segmentation/data/partner_segmentation_data.xml @@ -15,14 +15,17 @@ >Did you know? We guarantee that at least 80% of sponsorship donations - for gifts to your sponsored child and fund donations up to 100% - are invested in projects and programmes in the countries of the South. Thank you for the considerable impact you’ve already made.

Thank you for your precious support.

- + ]" + /> Movement Mobilizers @@ -37,7 +40,9 @@ >We are thrilled about your determination to fight injustices. We are so happy to count you as part of the growing number of people who are joining us in the fight against extreme poverty. We commit to providing platforms where you can advocate for children in need and the fight against extreme poverty and inspire others to join you.

Thank you for your precious support.

- + ]" + /> Compassionate Caregivers @@ -67,7 +73,9 @@ Thanks to our holistic approach to child development, we commit to a personal an >You can join us by making a spiritual impact in the lives of children in need through prayer and even get children in your surroundings involved in this endeavour.

Thank you for your precious support.

- + ]" + /> Hands-On Helpers @@ -106,14 +115,17 @@ Thanks to our holistic approach to child development, we commit to a personal an

Thank you for your precious support.

- + ]" + /> Curious Novices @@ -129,7 +141,9 @@ Thanks to our holistic approach to child development, we commit to a personal an

You can engage with us in flexible and manifold ways.

Thank you for your precious support.

- + ]" + /> diff --git a/partner_segmentation/models/partner_segment.py b/partner_segmentation/models/partner_segment.py index 95f71100d..864f04ed5 100644 --- a/partner_segmentation/models/partner_segment.py +++ b/partner_segmentation/models/partner_segment.py @@ -37,7 +37,7 @@ class ResPartnerSegment(models.Model): "res.partner.segment.link", "category_id", string="Personalized Links", - help="Useful resources for partners in this segment" + help="Useful resources for partners in this segment", ) image = fields.Binary(help="segment illustration") diff --git a/partner_segmentation/models/partner_segment_link.py b/partner_segmentation/models/partner_segment_link.py index 718837890..7f9332293 100644 --- a/partner_segmentation/models/partner_segment_link.py +++ b/partner_segmentation/models/partner_segment_link.py @@ -9,6 +9,7 @@ ############################################################################## from odoo import fields, models + class ResPartnerSegmentLink(models.Model): """ Model to store the @@ -20,24 +21,23 @@ class ResPartnerSegmentLink(models.Model): provide useful links to the partners based on their segmentation category and language. """ + _name = "res.partner.segment.link" _description = "Partner Segmentation Link" url = fields.Char( - required=True, - help="URL of the link to be provided to the partner" + required=True, help="URL of the link to be provided to the partner" ) label = fields.Char( - required=True, - help="Label of the link to be provided to the partner" + required=True, help="Label of the link to be provided to the partner" ) language_id = fields.Many2one( "res.lang", string="Language", - help="Language of the link, used to provide the link to the partner based on their language" + help="Language of the link, used to provide the link to the partner based on their language", ) category_id = fields.Many2one( "res.partner.segment", string="Category", - help="Segmentation category of the link, used to provide the link to the partner based on their segmentation category" - ) \ No newline at end of file + help="Segmentation category of the link, used to provide the link to the partner based on their segmentation category", + ) diff --git a/partner_segmentation/security/ir.model.access.csv b/partner_segmentation/security/ir.model.access.csv index 4fd5528db..fd5b537a3 100644 --- a/partner_segmentation/security/ir.model.access.csv +++ b/partner_segmentation/security/ir.model.access.csv @@ -4,4 +4,4 @@ full_access_partner_segmentation, Full access on partner segmentation,model_res_ read_access_partner_segmentation_affinity, Read access on partner segmentation affinity,model_res_partner_segment_affinity,base.group_user,1,0,0,0 read_access_partner_segmentation_affinity_portal, Read access on partner segmentation affinity,model_res_partner_segment_affinity,base.group_portal,1,0,0,0 full_access_partner_segmentation_affinity, Full access on partner segmentation affinity,model_res_partner_segment_affinity,base.group_system,1,1,1,1 -access_res_partner_segment_link_admin,res.partner.segment.link.admin,model_res_partner_segment_link,base.group_user,1,1,1,1 \ No newline at end of file +access_res_partner_segment_link_admin,res.partner.segment.link.admin,model_res_partner_segment_link,base.group_user,1,1,1,1 diff --git a/partner_segmentation/views/partner_segmentation_view.xml b/partner_segmentation/views/partner_segmentation_view.xml index 770075489..007f0d60b 100644 --- a/partner_segmentation/views/partner_segmentation_view.xml +++ b/partner_segmentation/views/partner_segmentation_view.xml @@ -24,10 +24,10 @@ - - - - + + + + From 4d3e696cccfb9c14986aedc57edd4b533d4569df Mon Sep 17 00:00:00 2001 From: Daniel Gergely Date: Thu, 26 Feb 2026 10:24:53 +0100 Subject: [PATCH 3/6] [T3022] FIX: GCA suggestions - FIX: added missing links - STYLE: pre-commit - FIX: corrected segmentation link access --- partner_segmentation/data/partner_segmentation_data.xml | 8 ++++++-- partner_segmentation/models/partner_segment_link.py | 6 ++++-- partner_segmentation/security/ir.model.access.csv | 3 ++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/partner_segmentation/data/partner_segmentation_data.xml b/partner_segmentation/data/partner_segmentation_data.xml index db6489f09..4b98f01f6 100644 --- a/partner_segmentation/data/partner_segmentation_data.xml +++ b/partner_segmentation/data/partner_segmentation_data.xml @@ -50,8 +50,8 @@ (0, 0, {'label': 'Facebook FR', 'url': 'https://facebook.com/compassionsuisse/', 'language_id': ref('base.lang_fr')}), (0, 0, {'label': 'Facebook DE', 'url': 'https://facebook.com/compassionschweiz/', 'language_id': ref('base.lang_de')}), (0, 0, {'label': 'Facebook IT', 'url': 'https://www.facebook.com/compassionsvizzera', 'language_id': ref('base.lang_it')}), - (0, 0, {'label': 'Instagram', 'url': 'https://www.instagram.com/compassionswiss/'}), - (0, 0, {'label': 'Vimeo', 'url': 'https://vimeo.com/compassionswitzerland'}), + (0, 0, {'label': 'Instagram', 'url': 'https://www.instagram.com/compassionswiss/', 'language_id': ref('base.lang_en')}), + (0, 0, {'label': 'Vimeo', 'url': 'https://vimeo.com/compassionswitzerland', 'language_id': ref('base.lang_en')}), (0, 0, {'label': 'Volunteering (FR)', 'url': 'https://compassion.ch/participer/', 'language_id': ref('base.lang_fr')}), (0, 0, {'label': 'Volunteering (DE)', 'url': 'https://compassion.ch/de/sich-mehr-engagieren/', 'language_id': ref('base.lang_de')}), (0, 0, {'label': 'Volunteering (IT)', 'url': 'https://compassion.ch/it/participare/', 'language_id': ref('base.lang_it')}), @@ -81,6 +81,7 @@ Thanks to our holistic approach to child development, we commit to a personal an (0, 0, {'label': 'Support Funds (IT)', 'url': 'https://compassion.ch/it/donare/', 'language_id': ref('base.lang_it')}), (0, 0, {'label': 'Step In My Shoes (FR)', 'url': 'https://compassion.ch/bienvenue-dans-mon-monde-philippines/', 'language_id': ref('base.lang_fr')}), (0, 0, {'label': 'Step In My Shoes (DE)', 'url': 'https://compassion.ch/de/komm-mit/', 'language_id': ref('base.lang_de')}), + (0, 0, {'label': 'Cool (DE)', 'url': 'https://compassion.ch/de/sonntagschulmaterial//', 'language_id': ref('base.lang_de')}), (0, 0, {'label': 'Latest Updates (FR)', 'url': 'https://compassion.ch/news/', 'language_id': ref('base.lang_fr')}), (0, 0, {'label': 'Latest Updates (DE)', 'url': 'https://compassion.ch/de/neues/', 'language_id': ref('base.lang_de')}), (0, 0, {'label': 'Latest Updates (IT)', 'url': 'https://compassion.ch/it/notizie/', 'language_id': ref('base.lang_it')}), @@ -153,6 +154,9 @@ Thanks to our holistic approach to child development, we commit to a personal an (0, 0, {'label': 'Facebook FR', 'url': 'https://facebook.com/compassionsuisse/', 'language_id': ref('base.lang_fr')}), (0, 0, {'label': 'Facebook DE', 'url': 'https://facebook.com/compassionschweiz/', 'language_id': ref('base.lang_de')}), (0, 0, {'label': 'Facebook IT', 'url': 'https://www.facebook.com/compassionsvizzera', 'language_id': ref('base.lang_it')}), + (0, 0, {'label': 'Instagram', 'url': 'https://www.instagram.com/compassionswiss/', 'language_id': ref('base.lang_en')}), + (0, 0, {'label': 'Vimeo', 'url': 'https://vimeo.com/compassionswitzerland', 'language_id': ref('base.lang_en')}), + ]" /> diff --git a/partner_segmentation/models/partner_segment_link.py b/partner_segmentation/models/partner_segment_link.py index 7f9332293..a0eb92d42 100644 --- a/partner_segmentation/models/partner_segment_link.py +++ b/partner_segmentation/models/partner_segment_link.py @@ -34,10 +34,12 @@ class ResPartnerSegmentLink(models.Model): language_id = fields.Many2one( "res.lang", string="Language", - help="Language of the link, used to provide the link to the partner based on their language", + help="Language of the link, used to provide the link to " + "the partner based on their language", ) category_id = fields.Many2one( "res.partner.segment", string="Category", - help="Segmentation category of the link, used to provide the link to the partner based on their segmentation category", + help="Segmentation category of the link, used to provide the " + "link to the partner based on their segmentation category", ) diff --git a/partner_segmentation/security/ir.model.access.csv b/partner_segmentation/security/ir.model.access.csv index fd5b537a3..02cd1527d 100644 --- a/partner_segmentation/security/ir.model.access.csv +++ b/partner_segmentation/security/ir.model.access.csv @@ -4,4 +4,5 @@ full_access_partner_segmentation, Full access on partner segmentation,model_res_ read_access_partner_segmentation_affinity, Read access on partner segmentation affinity,model_res_partner_segment_affinity,base.group_user,1,0,0,0 read_access_partner_segmentation_affinity_portal, Read access on partner segmentation affinity,model_res_partner_segment_affinity,base.group_portal,1,0,0,0 full_access_partner_segmentation_affinity, Full access on partner segmentation affinity,model_res_partner_segment_affinity,base.group_system,1,1,1,1 -access_res_partner_segment_link_admin,res.partner.segment.link.admin,model_res_partner_segment_link,base.group_user,1,1,1,1 +read_access_res_partner_segmentation_link, Read access on partner segmentation link,model_res_partner_segment_link,base.group_user,1,0,0,0 +full_access_partner_segmentation_link, Full access on partner segmentation link,model_res_partner_segment_link,base.group_system,1,1,1,1 From b4f4afddb602dd89746ce9e5465e808893c40a92 Mon Sep 17 00:00:00 2001 From: Daniel Gergely Date: Thu, 26 Feb 2026 15:20:38 +0100 Subject: [PATCH 4/6] [T3022] FIX: corrected link languages and labels --- .../data/partner_segmentation_data.xml | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/partner_segmentation/data/partner_segmentation_data.xml b/partner_segmentation/data/partner_segmentation_data.xml index 4b98f01f6..793bdf8e4 100644 --- a/partner_segmentation/data/partner_segmentation_data.xml +++ b/partner_segmentation/data/partner_segmentation_data.xml @@ -18,10 +18,10 @@ @@ -119,10 +119,10 @@ Thanks to our holistic approach to child development, we commit to a personal an @@ -43,18 +45,20 @@ @@ -76,16 +80,18 @@ Thanks to our holistic approach to child development, we commit to a personal an @@ -119,12 +125,14 @@ Thanks to our holistic approach to child development, we commit to a personal an @@ -145,18 +153,19 @@ Thanks to our holistic approach to child development, we commit to a personal an diff --git a/partner_segmentation/data/partner_segmentation_links.xml b/partner_segmentation/data/partner_segmentation_links.xml new file mode 100644 index 000000000..de46545f9 --- /dev/null +++ b/partner_segmentation/data/partner_segmentation_links.xml @@ -0,0 +1,118 @@ + + + + Latest Updates (FR) + https://compassion.ch/news/ + + + + Latest Updates (DE) + https://compassion.ch/de/neues/ + + + + Latest Updates (IT) + https://compassion.ch/it/notizie/ + + + + + Finances (FR) + https://compassion.ch/finances/ + + + + Finances (DE) + https://compassion.ch/de/finanzen/ + + + + Finances (IT) + https://compassion.ch/it/finanze/ + + + + + Volunteering (FR) + https://compassion.ch/participer/ + + + + Volunteering (DE) + https://compassion.ch/de/sich-mehr-engagieren/ + + + + Volunteering (IT) + https://compassion.ch/it/participare/ + + + + + Support Funds (FR) + https://compassion.ch/donations/ + + + + Support Funds (DE) + https://compassion.ch/de/spenden/ + + + + Support Funds (IT) + https://compassion.ch/it/donare/ + + + + + Facebook (FR) + https://facebook.com/compassionsuisse/ + + + + Facebook (DE) + https://facebook.com/compassionschweiz/ + + + + Facebook (IT) + https://www.facebook.com/compassionsvizzera + + + + Instagram + https://www.instagram.com/compassionswiss/ + + + + Vimeo + https://vimeo.com/compassionswitzerland + + + + Watch Videos + https://vimeo.com/compassionswitzerland + + + + + TOGETHER Project + https://together.compassion.ch/homepage + + + + Step In My Shoes (FR) + https://compassion.ch/bienvenue-dans-mon-monde-philippines/ + + + + Step In My Shoes (DE) + https://compassion.ch/de/komm-mit/ + + + + Cool (DE) + https://compassion.ch/de/sonntagschulmaterial// + + + \ No newline at end of file From 9079a70b456265e13c943108d525e0e62dcbe972 Mon Sep 17 00:00:00 2001 From: Daniel Gergely Date: Mon, 2 Mar 2026 16:00:07 +0100 Subject: [PATCH 6/6] [T3022] STYLE: pre-commit --- .../data/partner_segmentation_links.xml | 69 +++++++++++-------- 1 file changed, 41 insertions(+), 28 deletions(-) diff --git a/partner_segmentation/data/partner_segmentation_links.xml b/partner_segmentation/data/partner_segmentation_links.xml index de46545f9..094b0b8e5 100644 --- a/partner_segmentation/data/partner_segmentation_links.xml +++ b/partner_segmentation/data/partner_segmentation_links.xml @@ -1,118 +1,131 @@ - + Latest Updates (FR) https://compassion.ch/news/ - + - + Latest Updates (DE) https://compassion.ch/de/neues/ - + - + Latest Updates (IT) https://compassion.ch/it/notizie/ - + Finances (FR) https://compassion.ch/finances/ - + Finances (DE) https://compassion.ch/de/finanzen/ - + Finances (IT) https://compassion.ch/it/finanze/ - + Volunteering (FR) https://compassion.ch/participer/ - + Volunteering (DE) https://compassion.ch/de/sich-mehr-engagieren/ - + Volunteering (IT) https://compassion.ch/it/participare/ - + Support Funds (FR) https://compassion.ch/donations/ - + Support Funds (DE) https://compassion.ch/de/spenden/ - + Support Funds (IT) https://compassion.ch/it/donare/ - + Facebook (FR) https://facebook.com/compassionsuisse/ - + Facebook (DE) https://facebook.com/compassionschweiz/ - + Facebook (IT) https://www.facebook.com/compassionsvizzera - + Instagram https://www.instagram.com/compassionswiss/ - + Vimeo https://vimeo.com/compassionswitzerland - + Watch Videos https://vimeo.com/compassionswitzerland - + TOGETHER Project https://together.compassion.ch/homepage - + Step In My Shoes (FR) - https://compassion.ch/bienvenue-dans-mon-monde-philippines/ - + https://compassion.ch/bienvenue-dans-mon-monde-philippines/ + Step In My Shoes (DE) https://compassion.ch/de/komm-mit/ - + Cool (DE) - https://compassion.ch/de/sonntagschulmaterial// - + https://compassion.ch/de/sonntagschulmaterial// + - \ No newline at end of file +