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.