2
2
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
3
# flake8: noqa: B950
4
4
5
- import locale
6
-
7
5
from odoo import _ , models
8
6
9
7
@@ -16,7 +14,6 @@ def name_get(self):
16
14
Override the name_get method to customize the display name of records based on the context.
17
15
"""
18
16
context = self ._context or {}
19
- locale .setlocale (locale .LC_ALL , self .env .user .lang )
20
17
21
18
# Customize name display for 'advance_id' based on context
22
19
if "advance_id_name_get" in context and context ["advance_id_name_get" ]:
@@ -27,8 +24,8 @@ def name_get(self):
27
24
name = (
28
25
f"{ rec .name } | "
29
26
f"{ _ ('Date' )} : { rec .move_id .date .strftime ('%x' )} | "
30
- f"{ _ ('Total' )} : { locale . format_string ( '%.2f' , abs (rec .price_total ), grouping = True )} | "
31
- f"{ balance_str } : { locale . format_string ( '%.2f' , abs (rec .amount_residual ), grouping = True )} "
27
+ f"{ _ ('Total' )} : { format ( abs (rec .price_total ), '.2f' )} | "
28
+ f"{ balance_str } : { format ( abs (rec .amount_residual ), '.2f' )} "
32
29
)
33
30
result .append ((rec .id , name ))
34
31
return result
@@ -41,7 +38,7 @@ def name_get(self):
41
38
name = (
42
39
f"{ rec .name or rec .move_id .name } | "
43
40
f"{ _ ('Date' )} : { rec .date_maturity .strftime ('%x' )} | "
44
- f"{ _ ('Total' )} : { locale . format_string ( '%.2f' , abs (rec .price_total ), grouping = True )} "
41
+ f"{ _ ('Total' )} : { format ( abs (rec .price_total ), '.2f' )} "
45
42
)
46
43
result .append ((rec .id , name ))
47
44
return result
0 commit comments