[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 <tbe@odoo.com> opw-1928834 closes odoo/odoo#31732 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
co-authored by
Toufik Benjaa
parent
fdce99424b
commit
dd8494313f
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user