Allow to create invoices before bank transfer runs (#1734)

Co-authored-by: Raphael Michel <michel@rami.io>
This commit is contained in:
Felix Rindt
2020-08-04 10:53:59 +02:00
committed by GitHub
parent 9b367cb28b
commit 1c8699662d
8 changed files with 55 additions and 17 deletions

View File

@@ -933,8 +933,9 @@ def _perform_order(event: Event, payment_provider: str, position_ids: List[str],
pass
invoice = order.invoices.last() # Might be generated by plugin already
if event.settings.get('invoice_generate') == 'True' and invoice_qualified(order):
if not invoice:
if not invoice and invoice_qualified(order):
if event.settings.get('invoice_generate') == 'True' or (
event.settings.get('invoice_generate') == 'paid' and payment.payment_provider.requires_invoice_immediately):
invoice = generate_invoice(
order,
trigger_pdf=not event.settings.invoice_email_attachment or not order.email
@@ -1876,7 +1877,11 @@ class OrderChangeManager:
if self.reissue_invoice and self._invoice_dirty:
if i:
self._invoices.append(generate_cancellation(i))
if (i or self.event.settings.invoice_generate == 'True') and invoice_qualified(self.order):
if invoice_qualified(self.order) and \
(i or
self.event.settings.invoice_generate == 'True' or (
self.open_payment is not None and self.event.settings.invoice_generate == 'paid' and
self.open_payment.payment_provider.requires_invoice_immediately)):
self._invoices.append(generate_invoice(self.order))
def _check_complete_cancel(self):