Skip to content

Increase number of decimal places for account entry amounts#18

Open
omarkhan wants to merge 2 commits into
SwingTix:masterfrom
omarkhan:decimal-size
Open

Increase number of decimal places for account entry amounts#18
omarkhan wants to merge 2 commits into
SwingTix:masterfrom
omarkhan:decimal-size

Conversation

@omarkhan

Copy link
Copy Markdown
Contributor

Needed for currencies with high denominations, like Indonesian Rupiah. This pull request also adds a missing migration to make account names unique, and makes urls.py compatible with django 1.9.

@g--

g-- commented Feb 5, 2016

Copy link
Copy Markdown
Contributor

Yes. Yes, this. 8 decimal places isn't enough.

I've been thinking of solving the problem more generally: use an integer field and store the number of places after the decimal field in a currency table.

In the mean time, your patch works!

Comment thread swingtix/bookkeeper/models.py Outdated
account = models.ForeignKey(Account, db_column='accid', related_name='entries')

amount = models.DecimalField(max_digits=8, decimal_places=2,
amount = models.DecimalField(max_digits=1000, decimal_places=2,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about setting it to 16 instead of 1000? This would make it small enough to fit in a 64bit integer.
(64 bits is enough for a signed 18 digit number, minus 2 decimal places is 16.)

Is that enough?

@omarkhan omarkhan Feb 5, 2016 via email

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want to do the honours?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@g-- done, sorry for the delay

@omarkhan

omarkhan commented Apr 6, 2016

Copy link
Copy Markdown
Contributor Author

I have rebased this on top of master, but I can't seem to run the tests anymore as the settings file has been removed. How do you run the tests now?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants