simonluijk / django-invoice Goto Github PK
View Code? Open in Web Editor NEWDjango invoicing app
License: Other
Django invoicing app
License: Other
Hello,
Has anyone managed to implement Recurring invoice support for django-invoice as yet?
regards,
Errol
Does this project work? I'd like to use it if it does. If it does, anyway you could submit to pypi.python.org so it will be easy to install/manage?
Currently the model looks like the following:
class Invoice(models.Model):
user = models.ForeignKey(User)
currency = models.ForeignKey(Currency, blank=True, null=True)
address = models.ForeignKey(Address, related_name='%(class)s_set')
What do you think of breaking out the user, currency, and address, and instead, linking Invoice to 'Customer' in the following manner.
class Country(models.Model):
name = models.CharField( ... )
...
class Region(models.Model): # state/province/region
country = models.ForeignKey(Country)
...
class Locality(models.Model): # city/town/hamlet
region = models.ForeignKey(Region)
...
class Address(models.Model):
locality = models.ForeignKey(Locality)
...
class Currency(models.Model):
country = models.ManyToManyField(Country)
...
class Customer(models.Model):
address = models.ForeignKey(Address)
...
class Invoice(models.Model):
customer = models.ForeignKey(Customer)
def address(self):
return self.customer.address
def currency(self):
return self.customer.address.city.state.country.currency
A currency is an attribute of a country. However, a currency has nothing to do with an address. We could even add official_languages as a field to County, and have translations based on that, but it would be difficult to know when to stop. So that being said, maybe it is best to keep currency as a field in invoice.
Let me know what you think.
I forked and made some changes, but won't make a PR until I write test, and make sure everything works.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.