33# Copyright 2020 CorporateHub (https://corporatehub.eu)
44# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
55
6- import sys
76
87from odoo import api , fields , models
98from odoo .exceptions import ValidationError
1211from .accounting_none import AccountingNone
1312from .data_error import DataError
1413
15- if sys .version_info .major >= 3 :
16- unicode = str
17-
1814
1915class PropertyDict (dict ):
2016 def __getattr__ (self , name ):
2117 return self .get (name )
2218
23- def copy (self ): # pylint: disable=copy-wo-api-one,method-required-super
19+ # pylint: disable=method-required-super
20+ def copy (self ):
2421 return PropertyDict (self )
2522
2623
@@ -224,7 +221,8 @@ def render_num(
224221 if value is None or value is AccountingNone :
225222 return ""
226223 value = float_round (value / float (divider or 1 ), dp or 0 ) or 0
227- r = lang .format ("%%%s.%df" % (sign , dp or 0 ), value , grouping = True )
224+ format_str = f"%{ sign } .{ dp or 0 } f"
225+ r = lang .format (format_str , value , grouping = True )
228226 r = r .replace ("-" , "\N{NON-BREAKING HYPHEN} " )
229227 if prefix :
230228 r = prefix + "\N{NO-BREAK SPACE} " + r
@@ -240,7 +238,7 @@ def render_pct(self, lang, value, dp=1, sign="-"):
240238 def render_str (self , lang , value ):
241239 if value is None or value is AccountingNone :
242240 return ""
243- return unicode (value )
241+ return str (value )
244242
245243 @api .model
246244 def compare_and_render (
@@ -287,10 +285,8 @@ def compare_and_render(
287285 delta = AccountingNone
288286 elif var_type == TYPE_NUM :
289287 if value and average_value :
290- # pylint: disable=redefined-variable-type
291288 value = value / float (average_value )
292289 if base_value and average_base_value :
293- # pylint: disable=redefined-variable-type
294290 base_value = base_value / float (average_base_value )
295291 if compare_method == CMP_DIFF :
296292 delta = value - base_value
0 commit comments