[FIX] account,payment: instant payment post process

Fine-tuning of commit dd8494313f

closes odoo/odoo#32124

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
This commit is contained in:
Jorge Pinna Puissant
2019-03-26 11:10:52 +00:00
parent 660cd529ad
commit d8b45d24aa
2 changed files with 6 additions and 3 deletions
+1 -3
View File
@@ -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.
+5
View File
@@ -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.