# Path: invoicing/model_functions.py
# def generate_invoice_random_id():


import os
import uuid
import re
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from decimal import Decimal
from django.utils import timezone
from invoicing import model_functions
from django.utils.translation import ugettext_lazy as _
from django.core.validators import DecimalValidator, MaxLengthValidator
        ('OVERDUE', 'OVERDUE'),
        ('PAID_PARTIALLY', 'PAID PARTIALLY'),
        ('PAID_IN_FULL', 'PAID IN FULL'),
        ('CANCELLED', 'CANCELLED')
    )

    DISCOUNT_RATE = tuple((n, n) for n in range(0, 101, 5))

    TAX = (
        ('STANDARD', 'Invoice taxed at standard rate'),
        ('REDUCED', 'Invoice taxed at reduced rate'),
        ('NONE', 'No tax added to this invoice')
    )

    MONTHS = {
        1: _('Jan'), 2: _('Feb'), 3: _('Mar'), 4: _('Apr'),
        5: _('May'), 6: _('Jun'), 7: _('Jul'), 8: _('Aug'),
        9: _('Sep'), 10: _('Oct'), 11: _('Nov'), 12: _('Dec')
    }

    RECURRING = (
        (0, _('No')),
        (1, _('Daily')),
        (2, _('Monthly')),
        (3, _('Annual')),
    )

    client = models.ForeignKey('Account', related_name='invoice', on_delete=models.PROTECT,
                               verbose_name=_('Client'))
    invoice_number = models.CharField(max_length=255, blank=False, null=False, unique=True,

# Path: invoicing/model_functions.py
# def generate_invoice_random_id():


# Path: invoicing/models.py
import os
import uuid
import re
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from decimal import Decimal
from django.utils import timezone
from invoicing import model_functions
from django.utils.translation import ugettext_lazy as _
from django.core.validators import DecimalValidator, MaxLengthValidator

        ('OVERDUE', 'OVERDUE'),
        ('PAID_PARTIALLY', 'PAID PARTIALLY'),
        ('PAID_IN_FULL', 'PAID IN FULL'),
        ('CANCELLED', 'CANCELLED')
    )

    DISCOUNT_RATE = tuple((n, n) for n in range(0, 101, 5))

    TAX = (
        ('STANDARD', 'Invoice taxed at standard rate'),
        ('REDUCED', 'Invoice taxed at reduced rate'),
        ('NONE', 'No tax added to this invoice')
    )

    MONTHS = {
        1: _('Jan'), 2: _('Feb'), 3: _('Mar'), 4: _('Apr'),
        5: _('May'), 6: _('Jun'), 7: _('Jul'), 8: _('Aug'),
        9: _('Sep'), 10: _('Oct'), 11: _('Nov'), 12: _('Dec')
    }

    RECURRING = (
        (0, _('No')),
        (1, _('Daily')),
        (2, _('Monthly')),
        (3, _('Annual')),
    )

    client = models.ForeignKey('Account', related_name='invoice', on_delete=models.PROTECT,
                               verbose_name=_('Client'))
    invoice_number = models.CharField(max_length=255, blank=False, null=False, unique=True,

                                      default=model_functions.generate_invoice_random_id,