RamezIssac/django-erp-framework

i18n Paths Problem

Parthian opened this issue · 2 comments

Potentially an ERP problem but could be Jazzmin or a fault somewhere in my project.
Can anyone replicate?

I use en-gb/ and es/ for Spanish translation. i18n.
Main Urls.py is below.
It works a treat except for urls with es/ naturally in the path.

When moving from Spanish es/ to English the url gets mangled.
/humanresources/employee/
To
/humanresourcemployee/

Some code somewhere is stripping out every occurence of es/
I've tried many urls.py approaches and most created urls like
domain.com/es/humanresources/employee.

The setup below makes it much neater such that the en-gb/ or es/ never appear in the path.
domain.com/somemodelnotendingines/employee.

Remember, the fault only shows when moving from Spanish to English. I expect the same problem would occur with an app/model ending in any language code.

Finally, I'm using Jazzmin_Settings "language_chooser": True,

Django Extensions show urls.
/humanresources/employee/ django.contrib.admin.options.changelist_view erp_framework:humanresources_employee_changelist

from django.views.i18n import set_language
urlpatterns = [
path('admin/doc/', include('django.contrib.admindocs.urls')),
path("admin/", admin.site.urls),
path("i18n/", set_language, name='set_language'),
path('', erp_admin_site.urls),
]

There is a similar problem when visiting the Account profile of the logged in User.
KeyError
exception_value">'humanresources.employeedemographic'
Request Method: | GET
https://domain.com/auth/user/1/change/
4.2.5
KeyError
'humanresources.employeedemographic'
/home/xxxx/apps/xxxxxx/env/lib/python3.10/site-packages/erp_framework/reporting/models.py, line 28, in str

I think the code is perhaps trying to look for humanresources.employees/demographic ??? This is one of my Reports. Complete guess - could be an unrelated problem.

@register_report_view
class EmployeeDemographic(ReportView):

Also on my local development setup using runserver I see lots of could not reverse url issues.
Could not reverse url from humanresources.employee
Could not reverse url from humanresources.employee
Could not reverse url from humanresources.employee
Could not reverse url from humanresources.employee
[21/Sep/2023 12:54:16] "GET /qhse/safetyobservation/ HTTP/1.1" 200 59286

My guess is these occur due to the url getting mangled.

I've stripped out Django ERP and the problem is still there.
I think it must be a Jazzmin problem.
Either the strip is running from right to left or perhaps I have a urls.py problem where I'm running i18n twice.
Or a bug in Jazzmin.