Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Turtle6665 opened this issue Mar 10, 2024 · 2 comments · Fixed by #1292
Closed

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

Turtle6665 opened this issue Mar 10, 2024 · 2 comments · Fixed by #1292

Comments

@Turtle6665
Copy link
Contributor

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 :

if (
project is not None
and field.data != CurrencyConverter.no_currency
and project.has_bills()
):
msg = _(
"Cannot change project currency because currency conversion is broken"
)
raise ValidationError(msg)

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 almet closed this as not planned Won't fix, can't repro, duplicate, stale Mar 11, 2024
@almet almet reopened this Mar 11, 2024
@almet
Copy link
Member

almet commented Mar 11, 2024

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

@zorun
Copy link
Collaborator

zorun commented Mar 19, 2024

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

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 a pull request may close this issue.

3 participants