Date format is wrong

This call to setlocale is present for 10 years now.
I don’t know why you had a problem with 5.8. Probably some issues with your setup.

The setup is a standard installation of Debian buster. It is not an unusual system. I suspect other people will try to use Tryton on Debian because there are packages in Debian. Therefore, it would be really useful getting to the bottom of this issue.

If anybody can suggest things to check in the logs or if I can tweak the code anywhere to discover what is wrong then I’m happy to provide more detailed feedback.

I’m going to have another look at this at the end of this week. For comparison, I’ll try running 5.8.12 on the new Debian release, a different Python version and a Fedora system to see whether the same problem appears on all of these or only some of them.

Can anybody make any other suggestions about logging changes or interesting breakpoints for analyzing this issue?

While I can eliminate the problem by ensuring the language is set for each user, I think it is important to identify the root cause why %x is not giving consistent results.

Now I run a test on a system running Debian 11 (bullseye)

python3 -V
Python 3.9.2

I used the Tryton desktop 5.8.12 source tarball (there is no package available yet)

Connected to demo5.8.tryton.org as user admin

Looking at the user page, I see that no language is specified for the admin user

Looking at the configuration for fiscal years, I see the date appears as mm/dd/yyyy

I checked Python from the command line, it shows a date using dd/mm/yyyy which is the expected output for this system:

$ python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_ALL, '')
'en_GB.UTF-8'
>>> locale.getlocale()
('en_GB', 'UTF-8')
>>> import datetime
>>> x = datetime.datetime.now()
>>> print(x.strftime("%x"))
18/08/21
>>> 

The default language when user has no language is ‘en’ not ‘en_GB’.

On this machine, if I run the command locale it shows the following:

locale
LANG=en_GB.UTF-8
...
LC_TIME="en_GB.UTF-8"
...

Would it be helpful for Tryton to use these values automatically?

Or could it display a popup? “Your system locale is cc_LN with date format (foo). No locale is specified for your user account. Would you like to set your language now?”

Here is Issue 10673: Use default language to set locale for user without language - Tryton issue tracker