diff --git a/invoice.py b/invoice.py index 88bd23d..da3c433 100644 --- a/invoice.py +++ b/invoice.py @@ -255,6 +255,8 @@ class Invoice(metaclass=PoolMeta): config = Configuration(1) transaction = Transaction() + if self.type != 'out' or self.state not in ('posted', 'paid'): + return # send facturae to service if not service and config.facturae_service: service = config.facturae_service @@ -301,11 +303,6 @@ class Invoice(metaclass=PoolMeta): Date = pool.get('ir.date') Rate = pool.get('currency.currency.rate') - if self.type != 'out': - return - if self.state not in ('posted', 'paid'): - return - # These are an assert because it shouldn't happen assert self.invoice_date <= Date.today(), ( "Invoice date of invoice %s is in the future" % self.id)