Currency formatting is not possible using the 'C' locale
#1
Bonjour,

Je travaille à mettre en production une instance de crème en version 2.1.3 sur un serveur Ubuntu 18 avec Python 3.6.9 et Apache/modWSGI.
Tout fonctionne bien sauf quand j'essaie de rajouter une facture, je me retrouve avec une erreur 500.
Code :
LANG=fr_FR.UTF-8
LANGUAGE=
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=


Voici l'erreur que j'ai dans les logs =>


Code :
ERROR - django.request : Internal Server Error: /billing/invoice/22
Traceback (most recent call last):
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/core/handlers/base.py", line 145, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/core/handlers/base.py", line 143, in _get_response
    response = response.render()
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/response.py", line 106, in render
    self.content = self.rendered_content
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/response.py", line 83, in rendered_content
    content = template.render(context, self._request)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 171, in render
    return self._render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/defaulttags.py", line 398, in render
    return strip_spaces_between_tags(self.nodelist.render(context).strip())
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/library.py", line 192, in render
    output = self.func(*resolved_args, **resolved_kwargs)
  File "/srv/creme_crm-2.1/creme/creme_core/templatetags/creme_bricks.py", line 923, in brick_display
    for brick in bricks_to_render
  File "/srv/creme_crm-2.1/creme/creme_core/templatetags/creme_bricks.py", line 923, in <genexpr>
    for brick in bricks_to_render
  File "/srv/creme_crm-2.1/creme/creme_core/views/bricks.py", line 68, in render_detailview_brick
    return fun(context)
  File "/srv/creme_crm-2.1/creme/billing/bricks.py", line 129, in detailview_display
    related_item_label=self.related_item_label,
  File "/srv/creme_crm-2.1/creme/creme_core/gui/bricks.py", line 156, in _render
    return get_template(self.template_name).render(template_context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 171, in render
    return self._render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/defaulttags.py", line 309, in render
    return nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/defaulttags.py", line 513, in render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 188, in render
    return template.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 173, in render
    return self._render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/defaulttags.py", line 513, in render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/defaulttags.py", line 513, in render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/defaulttags.py", line 309, in render
    return nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 987, in render
    output = self.filter_expression.resolve(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 698, in resolve
    new_obj = func(obj, *arg_vals)
  File "/srv/creme_crm-2.1/creme/creme_core/templatetags/creme_core_tags.py", line 324, in format_amount
    return currency(amount, currency_or_id)
  File "/srv/creme_crm-2.1/creme/creme_core/utils/currency_format.py", line 103, in currency
    raise ValueError("Currency formatting is not possible using the 'C' locale.")
ValueError: Currency formatting is not possible using the 'C' locale.

J'ai vu qu'une personne avait eu plus ou moins le même problème ICI, mais pas avec le même fichier, du coup, je préfère venir chercher de l'aide ici avant d'essayer de modifier quoi que ce soit.

Je vous remercie par avance.
  Répondre
#2
Bonjour,

vous avez bien fait votre travail de recherche, il s'agit en effet probablement du même problème que dans le post que vous indiquez. Si vous avez lu le thread vous avez pu voir que la personne a arrêté de répondre, et donc la cause du problème n' a jamais pu être identifiée (et donc, corrigée). Vous pouvez donc :

1 - Appliquer la même correction qui avait marché dans son cas ; ça a l'avantage d'être rapide, mais vous devrez appliquer la correction à chaque changement de version (et ça n'aide pas les gens avec le potentiel même problème).
2 - M'aider à trouver la cause du problème (en continuant l'investigation interrompue de la dernière fois), ou bien debugger tout seul si vous savez le faire évidemment, pour pouvoir inclure une correction propre dans le code de Creme. C'est un peu plus long à court terme mais mieux à long terme.


Vous pouvez évidemment faire1 dans un premier temps pour avoir une instance qui marche et vous en servir, et faire 2 en parallèle.


Bonne journée !
  Répondre
#3
Très bien faisons comme ça.
Par contre j'ai besoin que vous m'expliquiez clairement ce que je dois modifier dans les fichiers python. Je n'ai pas beaucoup de compétence en développement.
Commençons par le point 1 puis le 2.
Merci
  Répondre
#4
Dans le cas de l'autre utilisateur, le changement suivant avait fonctionné : https://www.cremecrm.com/forum/showthread.php?tid=136&pid=626#pid626
(il s'agit du fichier creme/creme_core/utils/currency_format.py ).

J'espère que ça marchera pour vous.

Bonne journée !
  Répondre
#5
Après avoir modifié le fichier comme demandé =>

Code :
#    conv = _get_locale_conv(category=locale.LC_MONETARY,
#                            locale_code=standardized_locale_code(settings.LANGUAGE_CODE),
#                           )
   locale.setlocale(locale.LC_MONETARY, ('fr_FR', 'utf8'))
   conv = locale.localeconv()
   is_local_symbol = SettingValue.objects.get_4_key(currency_symbol_key).value




voici la nouvelle erreur =>
Code :
ERROR - django.request : Internal Server Error: /billing/invoice/24
Traceback (most recent call last):
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/core/handlers/base.py", line 145, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/core/handlers/base.py", line 143, in _get_response
    response = response.render()
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/response.py", line 106, in render
    self.content = self.rendered_content
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/response.py", line 83, in rendered_content
    content = template.render(context, self._request)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 171, in render
    return self._render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/defaulttags.py", line 398, in render
    return strip_spaces_between_tags(self.nodelist.render(context).strip())
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/library.py", line 192, in render
    output = self.func(*resolved_args, **resolved_kwargs)
  File "/srv/creme_crm-2.1/creme/creme_core/templatetags/creme_bricks.py", line 923, in brick_display
    for brick in bricks_to_render
  File "/srv/creme_crm-2.1/creme/creme_core/templatetags/creme_bricks.py", line 923, in <genexpr>
    for brick in bricks_to_render
  File "/srv/creme_crm-2.1/creme/creme_core/views/bricks.py", line 68, in render_detailview_brick
    return fun(context)
  File "/srv/creme_crm-2.1/creme/billing/bricks.py", line 129, in detailview_display
    related_item_label=self.related_item_label,
  File "/srv/creme_crm-2.1/creme/creme_core/gui/bricks.py", line 156, in _render
    return get_template(self.template_name).render(template_context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 171, in render
    return self._render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/defaulttags.py", line 309, in render
    return nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/defaulttags.py", line 513, in render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 188, in render
    return template.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 173, in render
    return self._render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/defaulttags.py", line 513, in render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/defaulttags.py", line 513, in render
    return self.nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/defaulttags.py", line 309, in render
    return nodelist.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 987, in render
    output = self.filter_expression.resolve(context)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 698, in resolve
    new_obj = func(obj, *arg_vals)
  File "/srv/creme_crm-2.1/creme/creme_core/templatetags/creme_core_tags.py", line 324, in format_amount
    return currency(amount, currency_or_id)
  File "/srv/creme_crm-2.1/creme/creme_core/utils/currency_format.py", line 87, in currency
    locale.setlocale(locale.LC_MONETARY, ('fr_FR', 'utf8'))
  File "/usr/lib/python3.6/locale.py", line 598, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
  Répondre
#6
Et avec 'fr' à la place de 'fr_FR' ?
  Répondre
#7
Toujours pareil =>


Code :
ERROR - django.request : Internal Server Error: /billing/invoice/25
Traceback (most recent call last):
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
  response = get_response(request)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/core/handlers/base.py", line 145, in _get_response
  response = self.process_exception_by_middleware(e, request)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/core/handlers/base.py", line 143, in _get_response
  response = response.render()
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/response.py", line 106, in render
  self.content = self.rendered_content
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/response.py", line 83, in rendered_content
  content = template.render(context, self._request)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/backends/django.py", line 61, in render
  return self.template.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 171, in render
  return self._render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
  return self.nodelist.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
  bit = node.render_annotated(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
  return self.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
  return compiled_parent._render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
  return self.nodelist.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
  bit = node.render_annotated(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
  return self.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
  return compiled_parent._render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
  return self.nodelist.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
  bit = node.render_annotated(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
  return self.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
  return compiled_parent._render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
  return self.nodelist.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
  bit = node.render_annotated(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
  return self.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
  return compiled_parent._render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
  return self.nodelist.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
  bit = node.render_annotated(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
  return self.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 62, in render
  result = block.nodelist.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
  bit = node.render_annotated(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
  return self.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/defaulttags.py", line 398, in render
  return strip_spaces_between_tags(self.nodelist.render(context).strip())
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
  bit = node.render_annotated(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
  return self.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 62, in render
  result = block.nodelist.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
  bit = node.render_annotated(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
  return self.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/library.py", line 192, in render
  output = self.func(*resolved_args, **resolved_kwargs)
File "/srv/creme_crm-2.1/creme/creme_core/templatetags/creme_bricks.py", line 923, in brick_display
  for brick in bricks_to_render
File "/srv/creme_crm-2.1/creme/creme_core/templatetags/creme_bricks.py", line 923, in <genexpr>
  for brick in bricks_to_render
File "/srv/creme_crm-2.1/creme/creme_core/views/bricks.py", line 68, in render_detailview_brick
  return fun(context)
File "/srv/creme_crm-2.1/creme/billing/bricks.py", line 129, in detailview_display
  related_item_label=self.related_item_label,
File "/srv/creme_crm-2.1/creme/creme_core/gui/bricks.py", line 156, in _render
  return get_template(self.template_name).render(template_context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/backends/django.py", line 61, in render
  return self.template.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 171, in render
  return self._render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
  return self.nodelist.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
  bit = node.render_annotated(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
  return self.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
  return compiled_parent._render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
  return self.nodelist.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
  bit = node.render_annotated(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
  return self.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
  return compiled_parent._render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
  return self.nodelist.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
  bit = node.render_annotated(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
  return self.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 62, in render
  result = block.nodelist.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
  bit = node.render_annotated(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
  return self.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/defaulttags.py", line 309, in render
  return nodelist.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
  bit = node.render_annotated(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
  return self.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/defaulttags.py", line 513, in render
  return self.nodelist.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
  bit = node.render_annotated(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
  return self.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/loader_tags.py", line 188, in render
  return template.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 173, in render
  return self._render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
  return self.nodelist.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
  bit = node.render_annotated(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
  return self.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/defaulttags.py", line 513, in render
  return self.nodelist.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
  bit = node.render_annotated(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
  return self.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/defaulttags.py", line 513, in render
  return self.nodelist.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
  bit = node.render_annotated(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
  return self.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/defaulttags.py", line 309, in render
  return nodelist.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 937, in render
  bit = node.render_annotated(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
  return self.render(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 987, in render
  output = self.filter_expression.resolve(context)
File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/template/base.py", line 698, in resolve
  new_obj = func(obj, *arg_vals)
File "/srv/creme_crm-2.1/creme/creme_core/templatetags/creme_core_tags.py", line 324, in format_amount
  return currency(amount, currency_or_id)
File "/srv/creme_crm-2.1/creme/creme_core/utils/currency_format.py", line 87, in currency
  locale.setlocale(locale.LC_MONETARY, ('fr', 'utf8'))
File "/usr/lib/python3.6/locale.py", line 598, in setlocale
  return _setlocale(category, locale)
locale.Error: unsupported locale setting
  Répondre
#8
On dirait que les locales françaises ne sont pas installées sur votre Ubuntu, comme l'indique la dernière ligne (désolé du lag, le forum semble n'envoyer des e-mails que quand ça lui chante).
  Répondre
#9
Effectivement j'ai donc installé le package suivant "apt-get install language-pack-fr"
J'ai remis le code python par défaut, la création de la facture fonctionne bien .

Par contre je ne peux pas générer le PDF de celle-ci, voici l'erreur:

Code :
[2020-04-23 22:37:26] ERROR - django.request : Internal Server Error: /billing/generate_pdf/26
Traceback (most recent call last):
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/home/user/.virtualenvs/creme_2_1/lib/python3.6/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/srv/creme_crm-2.1/creme/billing/views/export.py", line 88, in export_as_pdf
    f.write(smart_str(template.render(context)))
UnicodeEncodeError: 'ascii' codec can't encode character '\\xe9' in position 854: ordinal not in range(128)

J'ai vérifié les paquets nécessaires sont bien installés
  • texlive-latex-recommended
  • texlive-fonts-extra
  • texlive-lang-french
  • texlive-latex-extra
  Répondre
#10
Citation :Effectivement j'ai donc installé le package suivant "apt-get install language-pack-fr"


je vais l'ajouter dans le tutoriel d'installation ; je vais aussi améliorer le message d'erreur " Currency formatting is not possible..." afin qu'il soit plus explicite sur le fait qu'il manque peut-être la locale.


Citation :Par contre je ne peux pas générer le PDF de celle-ci, voici l'erreur:

Code :
UnicodeEncodeError: 'ascii' codec can't encode character '\\xe9' in position 854: ordinal not in range(128)

J'ai vérifié les paquets nécessaires sont bien installés


Il ne s'agit pas d'un problème avec Latex (qui est appelé une ligne après), mais un problème d'encodage au moment de la génération du ficher .tex . Le problème semble venir d'un caractère 'é'. Pouvez-vous me dire si vous avez un tel caractère dans un champs de la facture, ou une de ses lignes, afin que j'essaie de reproduire le problème ?
  Répondre


Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)