[IMP] py3o_report: Allow to specify the lang when calling o_format_lang
lang_code is already supported by o_format_datepull/445/head
parent
4d0f2585d3
commit
e5e6e9d379
|
@ -167,7 +167,7 @@ display_address(partner)
|
||||||
formatLang(value, digits=None, date=False, date_time=False, grouping=True, monetary=False, dp=False, currency_obj=False)
|
formatLang(value, digits=None, date=False, date_time=False, grouping=True, monetary=False, dp=False, currency_obj=False)
|
||||||
Return a formatted numeric, monetary, date or time value according to the context language and timezone
|
Return a formatted numeric, monetary, date or time value according to the context language and timezone
|
||||||
(old implementation kept for compatibility and ease migration)
|
(old implementation kept for compatibility and ease migration)
|
||||||
o_format_lang(value, digits=None, grouping=True, monetary=False, dp=False, currency_obj=False, no_break_space=True)
|
o_format_lang(value, lang_code=False, digits=None, grouping=True, monetary=False, dp=False, currency_obj=False, no_break_space=True)
|
||||||
Return a formatted numeric or monetary value according to the context language and timezone
|
Return a formatted numeric or monetary value according to the context language and timezone
|
||||||
o_format_date(value, lang_code=False, date_format=False)
|
o_format_date(value, lang_code=False, date_format=False)
|
||||||
Return a formatted date or time value according to the context language and timezone
|
Return a formatted date or time value according to the context language and timezone
|
||||||
|
|
|
@ -49,11 +49,15 @@ class Py3oParserContext(object):
|
||||||
'b64decode': b64decode,
|
'b64decode': b64decode,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _format_lang(self, value, digits=None, grouping=True,
|
def _format_lang(self, value, lang_code=False, digits=None, grouping=True,
|
||||||
monetary=False, dp=False, currency_obj=False,
|
monetary=False, dp=False, currency_obj=False,
|
||||||
no_break_space=True):
|
no_break_space=True):
|
||||||
|
env = self._env
|
||||||
|
if lang_code:
|
||||||
|
context = dict(env.context, lang=lang_code)
|
||||||
|
env = env(context=context)
|
||||||
formatted_value = misc.formatLang(
|
formatted_value = misc.formatLang(
|
||||||
self._env, value, digits=digits, grouping=grouping,
|
env, value, digits=digits, grouping=grouping,
|
||||||
monetary=monetary, dp=dp, currency_obj=currency_obj)
|
monetary=monetary, dp=dp, currency_obj=currency_obj)
|
||||||
if currency_obj and currency_obj.symbol and no_break_space:
|
if currency_obj and currency_obj.symbol and no_break_space:
|
||||||
parts = []
|
parts = []
|
||||||
|
|
Loading…
Reference in New Issue