spiral-project / ihatemoney

A simple shared budget manager web application
https://ihatemoney.org
Other
1.2k stars 270 forks source link

Changing any settings is prevented when project has existing currency #1291

Closed Turtle6665 closed 8 months ago

Turtle6665 commented 8 months ago

When a project as a default currency different from "XXX", changing the project settings will not be possible. An error is raised with the message : "Cannot change project currency because currency conversion is broken". The fact is that even if we don't want to change the currency, the message still shows up (same for the API).

This comes from this if statement : https://github.com/spiral-project/ihatemoney/blob/2bb535070aae0f708856f727156c89ce857b85bb/ihatemoney/forms.py#L196-L204

For me, a better if statement could be (although I didn't test it):

if ( 
     project is not None 
     and field.data != project.default_currency
     and project.has_bills() 
 ):

I know this was a hot fix waiting for improvement with the #1232 but checking for the current project default currency makes more sens considering the error message. This bug is annoying as to change the other settings, we have to set the currency to "no currency" as it's the only condition that doesn't raise this error.

almet commented 8 months ago

Thanks for the heads up, don't hesitate to provide a fix for this, I'll happily review and merge it :-)

zorun commented 8 months ago

Good catch with this bug, thanks for noticing and fixing it!