Skip to content

Invoice Numbers #2

Description

@vandorjw

Bug:

https://github.com/simonluijk/django-invoice/blob/master/invoice/utils/friendly_id.py#L74

Is broken on python3

I can fix it, and send a pull-request, but before I do, I would like to hear what you think about the following.

I agree that the invoice numbers should not expose how many invoices have been created. However the current implementation can be simplified, and become more meaningful, by setting the id to the following pattern.

invoice-id = yyyymmdd-aaaa0000

Today:

invoice-100 = 20140424-8cff2cdc

Tomorrow:

#Notice the date increased
invoice-101 = 20140425-175abd80

Where the first 8 digits are the date the invoice was created, and the last 8 digits are the first 8 digits from uuid4()

from uuid import uuid4
def test_uuid4():
    x = str(uuid4())
    print(x)
    print(x[:8])

result

test_uuid4()
    8cff2cdc-e535-45be-ada4-492fb6f6ff37
    8cff2cdc

Each invoice ID will be unique, and somewhat meaningful, since we prefix them all with the day.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions