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

Module: Italy - E-invoicing - Additional module to support the debit notes (nota di debito - NDD)

Entity: account.move

Compute Method: _compute_l10n_it_payment_method

Inputs Method Outputs
  • line_ids
  • payment_id
  • payment_id.payment_method_line_id
  • payment_id.payment_method_line_id.l10n_it_payment_method
  • l10n_it_payment_method
if self.env.company.account_fiscal_country_id.code != 'IT':
            return
move_lines_per_matching_number = self.env['account.move.line'].search([
            ('matching_number', 'in', self.line_ids.filtered('matching_number').mapped('matching_number')),
            ('company_id', '=', self.env.company.id),
        ]).grouped('matching_number')
for move in self:
            matching_numbers = move.line_ids.filtered('matching_number').mapped('matching_number')
            if matching_numbers:
                # We use matching_numbers[0] directly, assuming there's a valid key in the dictionary.
                matching_lines = move_lines_per_matching_number.get(matching_numbers[0])
                if matching_lines and matching_lines.payment_id:
                    payment_method_line = matching_lines.payment_id.payment_method_line_id[0]
                    if payment_method_line:
                        move.l10n_it_payment_method = payment_method_line.l10n_it_payment_method
                        continue  # Skip to the next move

            # Default handling if no valid matching lines found or if conditions don't match
            move.l10n_it_payment_method = move.payment_id.payment_method_line_id.l10n_it_payment_method or move.l10n_it_payment_method or 'MP05'

Back to entity