<commit_before># Copyright 2016 <NAME> <<EMAIL>>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class PaymentReturnReason(models.Model):
    _name = "payment.return.reason"
    _description = 'Payment return reason'

    code = fields.Char()
    name = fields.Char(string='Reason', translate=True)

    @api.model
    def name_search(self, name, args=None, operator='ilike', limit=100):
        args = args or []
        recs = self.browse()
        if name:
            recs = self.search([('code', '=', name)] + args, limit=limit)
        if not recs:
            recs = self.search([('name', operator, name)] + args, limit=limit)
        return recs.name_get()<commit_msg>[IMP] account_payment_return_import_sepa_pain: missing return reasons (#228)<commit_after># Copyright 2016 <NAME> <<EMAIL>>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class PaymentReturnReason(models.Model):
    _name = "payment.return.reason"
    _description = 'Payment return reason'

    code = fields.Char()
    name = fields.Char(string='Reason', translate=True)

    @api.model
    def name_search(self, name, args=None, operator='ilike', limit=100):
        args = args or []
        recs = self.browse()
        if name:
            recs = self.search([('code', '=', name)] + args, limit=limit)
        if not recs:
            recs = self.search([('name', operator, name)] + args, limit=limit)
        return recs.name_get()

    @api.multi
    def name_get(self):
        return [(r.id, "[{code}] {name}".format(code=r.code, name=r.name))
                for r in self]
{'fraction_non_alphanumeric': 0.15002988643156007, 'fraction_numerical': 0.012552301255230125, 'mean_word_length': 2.9668246445497632, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '2364463', 'n_tokens_mistral': 557, 'n_tokens_neox': 527, 'n_words': 134}