https://github.com/odoo/o-spreadsheet/commit/7d15d3c7 [REL] 16.4.0-alpha.6 https://github.com/odoo/o-spreadsheet/commit/56f3b593 [IMP] spreadsheet: add locale handling Task: 3222401 https://github.com/odoo/o-spreadsheet/commit/5aec70d4 [IMP] cell: store date string as value + format Task: 3222401 https://github.com/odoo/o-spreadsheet/commit/eeaf0083 [IMP] icons: add display header icon https://github.com/odoo/o-spreadsheet/commit/3f1e970c [FIX] SelectionInput: fix position of exclamation mark icon Task: 3355063 https://github.com/odoo/o-spreadsheet/commit/a46bf04e [FIX] LineBarPieConfigPanel: charts data series invalid input Task: 3355063 closes odoo/odoo#126679 Related: odoo/enterprise#43291 Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import api, models
|
|
|
|
from odoo.addons.spreadsheet.utils import (
|
|
strftime_format_to_spreadsheet_date_format,
|
|
strftime_format_to_spreadsheet_time_format,
|
|
)
|
|
|
|
|
|
class Lang(models.Model):
|
|
_inherit = "res.lang"
|
|
|
|
@api.model
|
|
def get_locales_for_spreadsheet(self):
|
|
"""Return the list of locales available for a spreadsheet."""
|
|
langs = self.with_context(active_test=False).search([])
|
|
|
|
spreadsheet_locales = [lang._odoo_lang_to_spreadsheet_locale() for lang in langs]
|
|
return spreadsheet_locales
|
|
|
|
def _odoo_lang_to_spreadsheet_locale(self):
|
|
"""Convert an odoo lang to a spreadsheet locale."""
|
|
return {
|
|
"name": self.name,
|
|
"code": self.code,
|
|
"thousandsSeparator": self.thousands_sep,
|
|
"decimalSeparator": self.decimal_point,
|
|
"dateFormat": strftime_format_to_spreadsheet_date_format(self.date_format),
|
|
"timeFormat": strftime_format_to_spreadsheet_time_format(self.time_format),
|
|
"formulaArgSeparator": ";" if self.decimal_point == "," else ",",
|
|
}
|