Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Third Party and Deferred/Electronic Checks Management

Entity: account.payment

Compute Method: _compute_l10n_latam_check_warning_msg

Inputs Method Outputs
"""
        Compute warning message for latam checks checks
        We use l10n_latam_check_number as de dependency because on the interface this is the field the user is using.
        Another approach could be to add an onchange on _inverse_l10n_latam_check_number method
        """
self.l10n_latam_check_warning_msg = False
latam_draft_checks = self.filtered(
            lambda x: x.state == 'draft' and (x.l10n_latam_manual_checks or x.payment_method_line_id.code in [
                'in_third_party_checks', 'out_third_party_checks', 'new_third_party_checks']))
for rec in latam_draft_checks:
            msgs = rec._get_blocking_l10n_latam_warning_msg()
            # new third party check
            if rec.l10n_latam_check_number and rec.payment_method_line_id.code == 'new_third_party_checks' and \
                    rec.l10n_latam_check_bank_id and rec.l10n_latam_check_issuer_vat:
                same_checks = self.search([
                    ('company_id', '=', rec.company_id.id),
                    ('l10n_latam_check_bank_id', '=', rec.l10n_latam_check_bank_id.id),
                    ('l10n_latam_check_issuer_vat', '=', rec.l10n_latam_check_issuer_vat),
                    ('check_number', '=', rec.l10n_latam_check_number),
                    ('id', '!=', rec._origin.id)])
                if same_checks:
                    msgs.append(_(
                        "Other checks were found with same number, issuer and bank. Please double check you are not "
                        "encoding the same check more than once. List of other payments/checks: %s",
                        ", ".join(same_checks.mapped('display_name'))))
            rec.l10n_latam_check_warning_msg = msgs and '* %s' % '\n* '.join(msgs) or False

Back to entity