Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion partner_salutation/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{
"name": "Compassion Partner Communications",
"summary": "Adds a salutation field on partners",
"version": "18.0.1.0.0",
"version": "18.0.1.1.0",
"development_status": "Production/Stable",
"category": "Partner Management",
"website": "https://github.com/CompassionCH/compassion-modules",
Expand Down
41 changes: 41 additions & 0 deletions partner_salutation/migrations/18.0.1.1.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
##############################################################################
#
# Copyright (C) 2026 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Noé Berdoz <nberdoz@compassion.ch>
#
# The licence is in the file __manifest__.py
#
##############################################################################
import logging

from odoo import SUPERUSER_ID, api

_logger = logging.getLogger(__name__)

# Salutations offered on the public-facing forms by default. Curators adjust
# the set afterwards from the title list; this only sets the initial value.
DEFAULT_PUBLIC_TITLE_XMLIDS = [
"base.res_partner_title_mister",
"base.res_partner_title_madam",
]


def migrate(cr, version):
"""Set the initial value of res.partner.title.is_shown_on_public_forms.

Runs once on the upgrade that introduces the field. Curators own the set
from then on, and later upgrades leave their choices untouched.
"""
env = api.Environment(cr, SUPERUSER_ID, {})
titles = env["res.partner.title"]
for xmlid in DEFAULT_PUBLIC_TITLE_XMLIDS:
title = env.ref(xmlid, raise_if_not_found=False)
if title:
titles |= title
if titles:
titles.is_shown_on_public_forms = True
_logger.info(
"Seeded is_shown_on_public_forms on default public titles: %s",
titles.mapped("name"),
)
5 changes: 5 additions & 0 deletions partner_salutation/models/res_partner_title.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ class ResPartnerTitle(models.Model):

plural = fields.Boolean()
order_index = fields.Integer()
is_shown_on_public_forms = fields.Boolean(
help="If set, this salutation is offered in the public-facing forms "
"(sponsorship wizard, donation, project creation). When unset, the "
"salutation stays usable in the backend but is hidden from those forms.",
)
1 change: 1 addition & 0 deletions partner_salutation/views/res_partner_title_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<field name="gender" />
<field name="plural" />
<field name="order_index" widget="handle" />
<field name="is_shown_on_public_forms" />
</field>
</field>
</record>
Expand Down
2 changes: 2 additions & 0 deletions sponsorship_compassion/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class ResPartner(models.Model):
required=True,
)
global_id = fields.Char("Global ID", copy=False)
legal_agreement_date = fields.Datetime("Date of legal agreement", tracking=True)
Comment thread
NoeBerdoz marked this conversation as resolved.
contracts_fully_managed = fields.One2many(
"recurring.contract",
compute="_compute_related_contracts",
Expand Down Expand Up @@ -464,6 +465,7 @@ def _random_str():
"title": False,
"country_id": False,
"uuid": False,
"legal_agreement_date": False,
}
)
partner.env["mail.mail"].search([("recipient_ids", "=", partner.id)]).unlink()
Expand Down
3 changes: 2 additions & 1 deletion sponsorship_compassion/tests/test_project_compassion.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
import random
from unittest.mock import patch

from dateutil.relativedelta import relativedelta

from odoo import fields
from odoo.tests import TransactionCase
from odoo.tools import relativedelta

PROJECT_COMPASSION_ADDON = (
"odoo.addons.child_compassion.models.project_compassion.CompassionProject"
Expand Down
1 change: 1 addition & 0 deletions sponsorship_compassion/views/res_partner_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<field name="uuid" position="after">
<field name="is_church" invisible="1" />
<field name="church_id" invisible="is_company or is_church" />
<field name="legal_agreement_date" />
</field>

<!-- Replace parent position of reference and global numbers -->
Expand Down
4 changes: 2 additions & 2 deletions thankyou_letters/tests/test_thankyou_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#
##############################################################################

from odoo.tests import SavepointCase
from odoo.tests import TransactionCase


class TestThankYouLetters(SavepointCase):
class TestThankYouLetters(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand Down
4 changes: 2 additions & 2 deletions thankyou_letters/tests/test_thankyou_letters.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import logging
import time

from odoo.tests import SavepointCase
from odoo.tests import TransactionCase

logger = logging.getLogger(__name__)


class TestThankYouLetters(SavepointCase):
class TestThankYouLetters(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand Down
Loading