[IMP] payment: remove duplicate chatter message

The confirmation message for the sale order appeared twice in the
chatter: first with the confirmation and second with the posted payment.
The second message is now rephrased in order to avoid any confusion for
the user (no double payment).

task-2965158

closes odoo/odoo#101921

X-original-commit: c1faff69db2a66e249bfbc5ea77644da0957d401
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: Vallaeys Valentin (vava) <vava@odoo.com>
This commit is contained in:
Valentin Vallaeys (vava)
2022-10-03 15:19:16 +02:00
parent 32f516fbd6
commit 6fc58cd0c6
2 changed files with 11 additions and 13 deletions
@@ -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 += "<br />" + _(
"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)
@@ -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):