You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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])
Sorry about not replying sooner. I did not receive a notification and was too absorbed with work to check GH.
I like what you have suggested especially removing friendly_id.py. I do think we should add some configuration options though. INVOICE_ID_PREPEND_DATE=True|False I think is self explanatory. INVOICE_ID_LENGTH=8 would limit the random chars appended. Also the invoice id should be uppercase for consistency.
The only advantage of using the current perfect hash implementation is that there is no chance of a collision. Either we live with the chance of a collision or add code to re-generate the invoice id on a collision.
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:
Tomorrow:
Where the first 8 digits are the date the invoice was created, and the last 8 digits are the first 8 digits from uuid4()
result
Each invoice ID will be unique, and somewhat meaningful, since we prefix them all with the day.
The text was updated successfully, but these errors were encountered: