[IMP] spreadsheet: detect mismatch in user/spreadsheet locale
This commit add a small indicator in the spreadsheet's control panel to indicate if the user's locale is different from the spreadsheet's. closes odoo/odoo#129857 Task: 3389491 X-original-commit: 5c776994f7bd230816369be3899989e7ab780906 Related: odoo/enterprise#44665 Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
This commit is contained in:
committed by
Rmi Rahir (rar)
parent
41e08479c8
commit
4c13f4f08c
@@ -19,6 +19,12 @@ class Lang(models.Model):
|
||||
spreadsheet_locales = [lang._odoo_lang_to_spreadsheet_locale() for lang in langs]
|
||||
return spreadsheet_locales
|
||||
|
||||
@api.model
|
||||
def get_user_spreadsheet_locale(self):
|
||||
"""Convert the odoo lang to a spreadsheet locale."""
|
||||
lang = self._lang_get(self.env.user.lang)
|
||||
return lang._odoo_lang_to_spreadsheet_locale()
|
||||
|
||||
def _odoo_lang_to_spreadsheet_locale(self):
|
||||
"""Convert an odoo lang to a spreadsheet locale."""
|
||||
return {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { constants } from "@odoo/o-spreadsheet";
|
||||
|
||||
registry
|
||||
.category("mock_server")
|
||||
.add("res.currency/get_currencies_for_spreadsheet", function (route, args) {
|
||||
const currencyNames = args.args[0];
|
||||
const result = [];
|
||||
for (let currencyName of currencyNames) {
|
||||
for (const currencyName of currencyNames) {
|
||||
const curr = this.models["res.currency"].records.find(
|
||||
(curr) => curr.name === currencyName
|
||||
);
|
||||
@@ -28,4 +29,7 @@ registry
|
||||
position: "after",
|
||||
decimalPlaces: 2,
|
||||
};
|
||||
})
|
||||
.add("res.lang/get_user_spreadsheet_locale", function (route, args) {
|
||||
return constants.DEFAULT_LOCALE;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user