Skip to content

Commit

Permalink
[FIX] sale_recurring_payment_mollie:Add a check on the date before ge…
Browse files Browse the repository at this point in the history
…nerating invoice
  • Loading branch information
ByteMeAsap committed Sep 10, 2024
1 parent 1eba669 commit 52d544a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions sale_recurring_payment_mollie/models/sale_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ def update_sale_subscription_payments(self, date_ref):
invoices = self.invoice_ids.filtered(
lambda i: i.invoice_date == date_ref
)
unpaid_invoice = self.env["account.move"]
if not invoices:
self.generate_invoice()
unpaid_invoice = self.invoice_ids.filtered(
lambda i: i.invoice_date == date_ref
and i.payment_state == "not_paid"
)
if date_ref == self.recurring_next_date:
self.generate_invoice()
unpaid_invoice = self.invoice_ids.filtered(
lambda i: i.invoice_date == date_ref
and i.payment_state == "not_paid"
)
else:
unpaid_invoice = invoices.filtered(
lambda i: i.payment_state == "not_paid"
Expand Down

0 comments on commit 52d544a

Please sign in to comment.