diff options
| author | Nicolas Lempereur <nle@odoo.com> | 2019-08-22 14:29:00 +0000 |
|---|---|---|
| committer | Nicolas Lempereur <nle@odoo.com> | 2019-08-27 11:19:10 +0000 |
| commit | c346e7af3314ce504fe3add9e9f6a4839bcad64a (patch) | |
| tree | 33563c50dac38e90c08dc690c0910f33544d7b98 /addons/l10n_multilang | |
| parent | 40487aca5cc52d62ad3fd08b9494f190e4413d8c (diff) | |
[FIX] l10n_*: translate COA on load without install
When a COA is installed being loaded for current company, the
translations of taxes, account name, ... (in l10n_be, l10n_ca, l10n_ch,
l10n_sa) are copied from the templates to the accounting records.
This is done in `post_init_hook` which is correct since then
translations are available to be copied.
But when an accounting localization is already installed and we set it
to a company, the translations are not copied.
eg. install l10n_be for company1: accounts name are translated in
french and dutch, set company2 to belgian accounting: only original
language is available.
With this changeset, the translation copy is also performed when an
accounting localization is loaded for a company after it has been
installed.
note: if we install language for first times after setting accounting
localizations, chart of account are translated in that language.
opw-2047013
closes #35985
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Diffstat (limited to 'addons/l10n_multilang')
| -rw-r--r-- | addons/l10n_multilang/models/l10n_multilang.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/addons/l10n_multilang/models/l10n_multilang.py b/addons/l10n_multilang/models/l10n_multilang.py index 2f6e3731faa..51ddb70c94c 100644 --- a/addons/l10n_multilang/models/l10n_multilang.py +++ b/addons/l10n_multilang/models/l10n_multilang.py @@ -12,6 +12,19 @@ _logger = logging.getLogger(__name__) class AccountChartTemplate(models.Model): _inherit = 'account.chart.template' + def load_for_current_company(self, sale_tax_rate, purchase_tax_rate): + res = super(AccountChartTemplate, self).load_for_current_company(sale_tax_rate, purchase_tax_rate) + # Copy chart of account translations when loading chart of account + for chart_template in self.filtered('spoken_languages'): + external_id = self.env['ir.model.data'].search([ + ('model', '=', 'account.chart.template'), + ('res_id', '=', chart_template.id), + ], order='id', limit=1) + module = external_id and self.env.ref('base.module_' + external_id.module) + if module and module.state == 'installed': + chart_template.process_coa_translations() + return res + @api.multi def process_translations(self, langs, in_field, in_ids, out_ids): """ |
