From dd8494313f23dca7c30005bb963b38eb2110eb52 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Fri, 8 Mar 2019 14:57:06 +0000 Subject: [PATCH] [FIX] account: instant payment post process When register a payment, and choosing a payment acquired. Before this commit, the payment post process had to wait until a cron run (every 10 minutes). Now, The post process is executed instantly after the payment, if the payment is not yet done, the post process will be executed in the next cron run. Co-authored-by: Toufik Benjaa opw-1928834 closes odoo/odoo#31732 Signed-off-by: Nicolas Martinelli (nim) --- addons/account/models/account_payment.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index fb2e7d59f30..d812d8e4955 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -661,7 +661,9 @@ class account_payment(models.Model): if any(len(record.invoice_ids) != 1 for record in self): # For multiple invoices, there is account.register.payments wizard raise UserError(_("This method should only be called to process a single invoice's payment.")) - return self.post() + res = self.post() + self.mapped('payment_transaction_id').filtered(lambda x: x.state == 'done' and not x.is_processed)._post_process_after_done() + return res def _create_payment_entry(self, amount): """ Create a journal entry corresponding to a payment, if the payment references invoice(s) they are reconciled.