Returnes next invoice number - reset yearly.

        .. warning::

            This is only used to prepopulate ``number`` field on saving new invoice.
            To get invoice number always use ``number`` field.

        .. note::

            To get invoice full number use ``invoice_id`` field.

        :return: string (generated next number)

def _get_next_number(self):
        """
        Returnes next invoice number - reset yearly.

        .. warning::

            This is only used to prepopulate ``number`` field on saving new invoice.
            To get invoice number always use ``number`` field.

        .. note::

            To get invoice full number use ``invoice_id`` field.

        :return: string (generated next number)
        """

        # Recupere les facture de l annee
        relative_invoices = Invoice.objects.filter(invoice_date__year=self.invoice_date.year)
        # on prend le numero le plus eleve du champs number, sinon on met 0
        last_number = relative_invoices.aggregate(Max('number'))['number__max'] or 0

        return last_number + 1