From 764a06bbe1cf811e5c79f8ec42dca096c8deefcd Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Wed, 18 Oct 2023 13:47:57 +0100 Subject: [PATCH] [FIX] account_invoice_report_payment_info: compute should be multi super() is multi-record, like all compute methods. This one should be too. Otherwise, it fails to integrate with `l10n_fr_account_vat_return` with `ValueError: Expected singleton: account.move(739, 737, 741, 735)`. @moduon MT-1075 --- .../models/account_invoice.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/account_invoice_report_payment_info/models/account_invoice.py b/account_invoice_report_payment_info/models/account_invoice.py index e5ade1c29..b5e4a7a1b 100644 --- a/account_invoice_report_payment_info/models/account_invoice.py +++ b/account_invoice_report_payment_info/models/account_invoice.py @@ -4,21 +4,22 @@ from odoo import models -class AccountInvoice(models.Model): +class AccountMove(models.Model): _inherit = "account.move" def _compute_payments_widget_reconciled_info(self): res = super()._compute_payments_widget_reconciled_info() - if not res and not self.invoice_payments_widget: - return res info_pattern = ( self.env["ir.config_parameter"] .sudo() .get_param("account_invoice_report_payment_info.info_pattern", default="") ) Move = self.env["account.move"] - for payment_dict in self.invoice_payments_widget["content"]: - move = Move.browse(payment_dict["move_id"]) - payment_dict["move_ref"] = move.ref - payment_dict["extra_info"] = info_pattern.format(**payment_dict) + for one in self: + if not res and not one.invoice_payments_widget: + continue + for payment_dict in one.invoice_payments_widget["content"]: + move = Move.browse(payment_dict["move_id"]) + payment_dict["move_ref"] = move.ref + payment_dict["extra_info"] = info_pattern.format(**payment_dict) return res