Skip to content

Commit

Permalink
[FIX] account_invoice_report_payment_info: compute should be multi
Browse files Browse the repository at this point in the history
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
  • Loading branch information
yajo committed Oct 18, 2023
1 parent 703df8e commit 764a06b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions account_invoice_report_payment_info/models/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 764a06b

Please sign in to comment.