<commit_before>##############################################################################
#
#    Copyright (C) 2014-2015 Compassion CH (http://www.compassion.ch)
#    Releasing children from poverty in Jesus' name
#    @author: <NAME>
#
#    The licence is in the file __manifest__.py
#
##############################################################################

from odoo import api, models, _


# pylint: disable=C8107
class ResPartnerBank(models.Model):
    """ This class upgrade the partners.bank to match Compassion needs.
    """

    _inherit = "res.partner.bank"

    @api.model
    def create(self, data):
        """Override function to notify creation in a message
        """
        result = super().create(data)

        part = result.partner_id
        if part:<commit_msg>CS-661 Support template for Christmas Gift Fund failed<commit_after>##############################################################################
#
#    Copyright (C) 2014-2015 Compassion CH (http://www.compassion.ch)
#    Releasing children from poverty in Jesus' name
#    @author: <NAME>
#
#    The licence is in the file __manifest__.py
#
##############################################################################

from odoo import api, models, _


# pylint: disable=C8107
class ResPartnerBank(models.Model):
    """ This class upgrade the partners.bank to match Compassion needs.
    """

    _inherit = "res.partner.bank"

    def build_swiss_code_vals(self, amount, *args):
        """In l10n_ch's build_swiss_code_vals the amount must be a number
        and can't be empty to be allowed in post offices.
        This function is a workaround to this problem.
        We also ensure that the amount is in the range specified by the swiss qr specifications.
        """
        must_be_corrected = type(amount) not in [int, float] or not (0.01 <= amount <= 999999999.99)
        if not must_be_corrected:
            return super().build_swiss_code_vals(amount, *args)

        amount = -3141592.64 # dummy value
        qr_code_vals = super().build_swiss_code_vals(amount, *args)
        # ensure that this position is still the amount
        assert qr_code_vals[18] == f"{amount:.2f}"
        qr_code_vals[18] = ""
        return qr_code_vals

    @api.model
    def create(self, data):
        """Override function to notify creation in a message
        """
        result = super().create(data)

        part = result.partner_id
        if part:
{'fraction_non_alphanumeric': 0.2105691056910569, 'fraction_numerical': 0.023170731707317073, 'mean_word_length': 3.2949389179755673, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6715127', 'n_tokens_mistral': 738, 'n_tokens_neox': 657, 'n_words': 213}