Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
dee602d
[T2945] REFACTOR: gift limits are now translatable (#2074)
Danielgergely Feb 5, 2026
4347ff0
Update translations
ecino Feb 5, 2026
2ba6374
Update compassion_intervention_view.xml
davidwul Feb 11, 2026
0ceb567
T2792 Ensure child protection on children page (#2059)
Shayan105 Feb 12, 2026
d204fb9
[T2987] REFACTOR: moved language detection to generator (#2076)
Danielgergely Feb 16, 2026
0aade42
[T2986] FIX: direction is now explicitly set through message values (…
Danielgergely Feb 16, 2026
f2795a6
[T2996] FIX: sponsor letter now have the status "read" by default
Danielgergely Feb 18, 2026
f72a9ad
FIX missing file_name in letters
ecino Feb 18, 2026
ffa0186
FIX FIX missing file_name in letters
ecino Feb 18, 2026
6b44dca
[FIX] transaction handling for correspondence_s2b_generator.py
ecino Feb 23, 2026
bf2a5f1
T2840 add category and description code snippet (#2070)
avuff Feb 26, 2026
9e8c435
[T1142] New Suspension Communication Rules (#2069)
avuff Mar 5, 2026
91e12c8
[T3035] FIX: language detection now does not overwrite source/target …
Danielgergely Mar 12, 2026
1e439a9
Update gift_thresholds.xml (#2083)
davidwul Mar 16, 2026
0480c23
T3063 ADD missing xmlid entry
ecino Mar 18, 2026
fdc186d
T3059 fcp lifecycle events (#2084)
Danielgergely Mar 18, 2026
6577910
Update account.analytic.group.csv
davidwul Mar 23, 2026
5a53549
FIX: corrected order of funds in account.analytic.group.csv
Danielgergely Mar 23, 2026
5e792e3
[T2747] FIX: moved state update to after payment configuration (#2086)
ecino Mar 26, 2026
c70614b
T2975 UPD German childpack
ecino Apr 1, 2026
914e4e1
Run pre-commit
ecino Apr 2, 2026
7f4ee25
FIX migration in script in v17
ecino Apr 2, 2026
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
40 changes: 20 additions & 20 deletions advanced_translation/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ Usage

You can go in the Technical Settings/Translations/Advanced Translations

- Enter all terms you want to use

- Use method get of ir.advanced.translation in order to fetch
translations

- Make models inherit the class 'translatable.model' so that they can
now use these methods:

- translate(field_name): Will retrieve the translation of a
char/selection field and replaces keywords by advanced
translations. Keywords should be placed in brackets.
- get_list: Return comma separated field values (see doc in
translatable_model.py)
- get_date(field_name, date_format='date_full'): Returns a date
field directly formatted in the format wanted. date_format can be
an advanced translation which will return the date format wanted
(can change depending on the language), or it can directly be a
date format used by Babel package :
http://babel.pocoo.org/en/latest/dates.html
- Enter all terms you want to use

- Use method get of ir.advanced.translation in order to fetch
translations

- Make models inherit the class 'translatable.model' so that they can
now use these methods:

- translate(field_name): Will retrieve the translation of a
char/selection field and replaces keywords by advanced translations.
Keywords should be placed in brackets.
- get_list: Return comma separated field values (see doc in
translatable_model.py)
- get_date(field_name, date_format='date_full'): Returns a date field
directly formatted in the format wanted. date_format can be an
advanced translation which will return the date format wanted (can
change depending on the language), or it can directly be a date
format used by Babel package :
http://babel.pocoo.org/en/latest/dates.html

Bug Tracker
===========
Expand All @@ -81,7 +81,7 @@ Authors
Contributors
------------

- Emanuel Cino <ecino@compassion.ch>
- Emanuel Cino <ecino@compassion.ch>

Maintainers
-----------
Expand Down
14 changes: 7 additions & 7 deletions advanced_translation/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -400,15 +400,15 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<li>Make models inherit the class ‘translatable.model’ so that they can
now use these methods:<ul>
<li>translate(field_name): Will retrieve the translation of a
char/selection field and replaces keywords by advanced
translations. Keywords should be placed in brackets.</li>
char/selection field and replaces keywords by advanced translations.
Keywords should be placed in brackets.</li>
<li>get_list: Return comma separated field values (see doc in
translatable_model.py)</li>
<li>get_date(field_name, date_format=’date_full’): Returns a date
field directly formatted in the format wanted. date_format can be
an advanced translation which will return the date format wanted
(can change depending on the language), or it can directly be a
date format used by Babel package :
<li>get_date(field_name, date_format=’date_full’): Returns a date field
directly formatted in the format wanted. date_format can be an
advanced translation which will return the date format wanted (can
change depending on the language), or it can directly be a date
format used by Babel package :
<a class="reference external" href="http://babel.pocoo.org/en/latest/dates.html">http://babel.pocoo.org/en/latest/dates.html</a></li>
</ul>
</li>
Expand Down
32 changes: 16 additions & 16 deletions child_compassion/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ Configuration
Access rights
-------------

- Assign the rights to the users so that they can access the new
"Sponsorship" menu
- Assign the rights to the users so that they can access the new
"Sponsorship" menu

Configuration menu
------------------

- Find the configuration menu in Sponsorship/Configuration (must be
given rights)
- Configure the default hold durations in the menu Global
Childpool/Availability Management
- Assign people to be notified when receiving National Office Disaster
Alerts using the menu Communication/Staff Notifications
- Find the configuration menu in Sponsorship/Configuration (must be
given rights)
- Configure the default hold durations in the menu Global
Childpool/Availability Management
- Assign people to be notified when receiving National Office Disaster
Alerts using the menu Communication/Staff Notifications

Odoo.conf file
--------------
Expand All @@ -70,8 +70,8 @@ Demand planning
You can add in the system settings default values for weekly demand and
resupply quantities by setting the following keys:

- child_compassion.default_demand
- child_compassion.default_resupply
- child_compassion.default_demand
- child_compassion.default_resupply

Usage
=====
Expand All @@ -84,8 +84,8 @@ Changelog
14.0.1.4.0
----------

- ADD World Bank Data API fields in the Field Offices for fetching
country statistics.
- ADD World Bank Data API fields in the Field Offices for fetching
country statistics.

Bug Tracker
===========
Expand All @@ -108,10 +108,10 @@ Authors
Contributors
------------

- Emanuel Cino <ecino@compassion.ch>
- Cyril Sester <cyril.sester@outlook.com>
- Kevin Cristi <kcristi@compassion.ch>
- David Coninckx <david@coninckx.com>
- Emanuel Cino <ecino@compassion.ch>
- Cyril Sester <cyril.sester@outlook.com>
- Kevin Cristi <kcristi@compassion.ch>
- David Coninckx <david@coninckx.com>

Maintainers
-----------
Expand Down
2 changes: 1 addition & 1 deletion child_compassion/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# pylint: disable=C8101
{
"name": "Compassion Children",
"version": "17.0.1.0.7",
"version": "17.0.1.0.9",
"category": "Compassion",
"author": "Compassion CH",
"license": "AGPL-3",
Expand Down
23 changes: 23 additions & 0 deletions child_compassion/migrations/17.0.1.0.9/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from openupgradelib import openupgrade


def migrate(cr, version):
if not openupgrade.column_exists(
cr, "compassion_project", "gps_latitude_obfuscated"
):
openupgrade.logged_query(
cr,
"""
ALTER TABLE compassion_project
ADD COLUMN gps_latitude_obfuscated float,
ADD COLUMN gps_longitude_obfuscated float;
""",
)
openupgrade.logged_query(
cr,
"""
UPDATE compassion_project
SET gps_longitude_obfuscated = TRUNC(CAST(gps_longitude AS numeric), 0),
gps_latitude_obfuscated = TRUNC(CAST(gps_latitude AS numeric), 0);
""",
)
67 changes: 63 additions & 4 deletions child_compassion/models/project_compassion.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import logging
import re
from datetime import datetime, timedelta
from random import random

import requests

Expand Down Expand Up @@ -85,6 +86,12 @@ class CompassionProject(models.Model):
zip_code = fields.Char(readonly=True)
gps_latitude = fields.Float(readonly=True)
gps_longitude = fields.Float(readonly=True)
gps_latitude_obfuscated = fields.Float(
compute="_compute_gps_obfuscated", store=True
)
gps_longitude_obfuscated = fields.Float(
compute="_compute_gps_obfuscated", store=True
)
google_link = fields.Char(readonly=True, compute="_compute_google_link")
timezone = fields.Char(readonly=True, compute="_compute_timezone", store=True)
cluster = fields.Char(readonly=True)
Expand Down Expand Up @@ -473,13 +480,26 @@ def _get_months(self):
@api.depends("lifecycle_ids", "lifecycle_ids.date")
def _compute_last_lifecycle(self):
for project in self:
last_info = project.lifecycle_ids[:1]
reactivation_lifecycle = project.lifecycle_ids.filtered(
if not project.lifecycle_ids:
project.last_lifecycle_id = False
continue

# Sort lifecycle events by date descending
sorted_events = project.lifecycle_ids.sorted(
key=lambda r: (str(r.date or ""), r.id), reverse=True
)
# Take first (newest) event
last_info = sorted_events[0]

reactivation_lifecycle = sorted_events.filtered(
lambda r, _last=last_info: r.date == _last.date
and r.type == "Reactivation"
)[:1]
)

# If it exists, lifecycle with type 'Reactivation' is determinant
project.last_lifecycle_id = reactivation_lifecycle or last_info
project.last_lifecycle_id = (
reactivation_lifecycle[0] if reactivation_lifecycle else last_info
)

def _search_last_lifecycle_id(self, operator, value):
return [("lifecycle_ids", operator, value)]
Expand Down Expand Up @@ -516,6 +536,45 @@ def _get_materials(self):
("Plastic", "Plastic"),
]

@api.depends("gps_latitude", "gps_longitude", "closest_city")
def _compute_gps_obfuscated(self):
"""
This method calculates and stores the obfuscated coordinates
(latitude and longitude).
"""
api_key = (
self.env["ir.config_parameter"].sudo().get_param("google_maps_api_key")
)
base_url = "https://maps.googleapis.com/maps/api/geocode/json"
for project in self:
try:
parts = [
project.closest_city,
project.state_province,
project.country_id.name,
]
address_string = ", ".join(filter(None, parts))
params = {"address": address_string, "key": api_key}
response = requests.get(base_url, params=params, timeout=3)
data = response.json()
if data["status"] == "OK":
location = data["results"][0]["geometry"]["location"]
project.gps_latitude_obfuscated = location["lat"]
project.gps_longitude_obfuscated = location["lng"]
except Exception:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The try...except block uses a broad except Exception. This can hide unexpected errors and make debugging more difficult. It's better to catch more specific exceptions that you expect to handle, such as requests.exceptions.RequestException for network issues, and KeyError or IndexError for issues with the response data structure.

Suggested change
except Exception:
except (requests.exceptions.RequestException, KeyError, IndexError):

# Fallback to randomized gps coords
logging.warning("Request failed", exc_info=True)
project.gps_latitude_obfuscated = (
(int(project.gps_latitude) + random())
if project.gps_latitude
else 0
)
project.gps_longitude_obfuscated = (
(int(project.gps_longitude) + random())
if project.gps_longitude
else 0
)

@api.depends("gps_longitude", "gps_latitude")
def _compute_timezone(self):
tf = TimezoneFinder()
Expand Down
Binary file modified child_compassion/static/img/child_compassion.childpack_full/1904_dossier_de_DE.jpg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...d_compassion/static/img/child_compassion.childpack_small/1904_dossier_de_DE.jpg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion child_compassion/views/project_compassion_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@
</group>
<group string="Lifecycle">
<field name="lifecycle_ids">
<tree>
<tree
default_order="date desc, id desc"
>
<field name="create_date" />
<field name="date" />
<field name="type" />
Expand Down
4 changes: 2 additions & 2 deletions gift_compassion/data/gift_thresholds.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<odoo>
<odoo noupdate="1">
<!-- Gift Thresholds -->
<record id="gt-01" model="gift.threshold.settings">
<field
Expand Down Expand Up @@ -47,4 +47,4 @@
<field name="max_amount">2000</field>
<field name="currency_id" ref="base.USD" />
</record>
</odoo>
</odoo>
Loading
Loading