diff --git a/addons/account_payment/models/payment_transaction.py b/addons/account_payment/models/payment_transaction.py index 48e7e04a65b..7741839f00e 100644 --- a/addons/account_payment/models/payment_transaction.py +++ b/addons/account_payment/models/payment_transaction.py @@ -188,19 +188,18 @@ class PaymentTransaction(models.Model): for invoice in self.invoice_ids: invoice.message_post(body=message) - #=== BUSINESS METHODS - GETTERS ===# + #=== BUSINESS METHODS - POST-PROCESSING ===# - def _get_received_message(self): - """ Return the message stating that the transaction has been received by the provider. + def _finalize_post_processing(self): + """ Override of `payment` to write a message in the chatter with the payment and transaction + references. - Note: self.ensure_one() + :return: None """ - message = super()._get_received_message() - - if self.state == 'done' and self.payment_id: - message += "
" + _( - "The related payment is posted: %s", - self.payment_id._get_html_link() + super()._finalize_post_processing() + for tx in self.filtered('payment_id'): + message = _( + "The payment related to the transaction with reference %(ref)s has been posted: " + "%(link)s", ref=tx.reference, link=tx.payment_id._get_html_link() ) - - return message + tx._log_message_on_linked_documents(message) diff --git a/addons/payment/models/payment_transaction.py b/addons/payment/models/payment_transaction.py index 24e231baf62..b2f61bdbf31 100644 --- a/addons/payment/models/payment_transaction.py +++ b/addons/payment/models/payment_transaction.py @@ -839,7 +839,6 @@ class PaymentTransaction(models.Model): :return: None """ self._reconcile_after_done() - self._log_received_message() # 2nd call to link the created account.payment in the chatter self.is_post_processed = True def _cron_finalize_post_processing(self):