From d8b45d24aae5a8d6d16d8417600101ebdd38bfc7 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Tue, 26 Mar 2019 11:10:52 +0000 Subject: [PATCH] [FIX] account,payment: instant payment post process Fine-tuning of commit dd8494313f23dca7c30005bb963b38eb2110eb52 closes odoo/odoo#32124 Signed-off-by: Lucas Perais (lpe) --- addons/account/models/account_payment.py | 4 +--- addons/payment/models/account_payment.py | 5 +++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index d812d8e4955..fb2e7d59f30 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -661,9 +661,7 @@ 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.")) - 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 + return self.post() def _create_payment_entry(self, amount): """ Create a journal entry corresponding to a payment, if the payment references invoice(s) they are reconciled. diff --git a/addons/payment/models/account_payment.py b/addons/payment/models/account_payment.py index 21c0b5530dd..220cb37db38 100644 --- a/addons/payment/models/account_payment.py +++ b/addons/payment/models/account_payment.py @@ -71,6 +71,11 @@ class AccountPayment(models.Model): return transactions + def action_validate_invoice_payment(self): + res = super(AccountPayment, self).action_validate_invoice_payment() + self.mapped('payment_transaction_id').filtered(lambda x: x.state == 'done' and not x.is_processed)._post_process_after_done() + return res + @api.multi def post(self): # Post the payments "normally" if no transactions are needed.