[FIX] account: correct communication when registering payment for multiple invoices
When a user register a payment for multiple invoices,
the communication field is populated using all invoices.
However the payment should use the communication individually for each invoice.
This is a behaviour closer to what is done in 74b6f84cc8 for v12.
opw 1954887
closes odoo/odoo#32143
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
This commit is contained in:
@@ -194,11 +194,13 @@ class account_register_payments(models.TransientModel):
|
||||
'''
|
||||
amount = self._compute_payment_amount(invoices) if self.multi else self.amount
|
||||
payment_type = ('inbound' if amount > 0 else 'outbound') if self.multi else self.payment_type
|
||||
communication = (' '.join([inv.reference or inv.number for inv in invoices])
|
||||
if self.multi else self.communication)
|
||||
return {
|
||||
'journal_id': self.journal_id.id,
|
||||
'payment_method_id': self.payment_method_id.id,
|
||||
'payment_date': self.payment_date,
|
||||
'communication': self.communication,
|
||||
'communication': communication, # DO NOT FORWARD PORT TO V12 OR ABOVE
|
||||
'invoice_ids': [(6, 0, invoices.ids)],
|
||||
'payment_type': payment_type,
|
||||
'amount': abs(amount),
|
||||
|
||||
Reference in New Issue
Block a user