mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
@@ -54,3 +54,20 @@ class TestAccountChartUpdate(TestAccountChartUpdateCommon):
|
|||||||
lang_model = self.env["res.lang"]
|
lang_model = self.env["res.lang"]
|
||||||
lang_model.search([("code", "=", "en_US")]).write({"active": False})
|
lang_model.search([("code", "=", "en_US")]).write({"active": False})
|
||||||
self.test_update_taxes()
|
self.test_update_taxes()
|
||||||
|
|
||||||
|
def test_update_fiscal_position(self):
|
||||||
|
"""Fiscal position without translations should not be taking into
|
||||||
|
account of being translated."""
|
||||||
|
self.fp_template.note = ""
|
||||||
|
wizard = self.wizard_obj.create(self.wizard_vals)
|
||||||
|
wizard.action_find_records()
|
||||||
|
wizard.action_update_records()
|
||||||
|
new_fp = self.env["account.fiscal.position"].search(
|
||||||
|
[
|
||||||
|
("name", "=", self.fp_template.name),
|
||||||
|
("company_id", "=", self.company.id),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
self.assertEqual(new_fp.with_context(lang="en_US").note, self.fp_template.note)
|
||||||
|
self.assertEqual(new_fp.with_context(lang="es_ES").note, self.fp_template.note)
|
||||||
|
self.assertEqual(new_fp.with_context(lang="fr_FR").note, self.fp_template.note)
|
||||||
|
|||||||
@@ -31,8 +31,11 @@ class WizardUpdateChartsAccount(models.TransientModel):
|
|||||||
for key in self._diff_translate_fields(template, rec):
|
for key in self._diff_translate_fields(template, rec):
|
||||||
for lang in self._other_langs():
|
for lang in self._other_langs():
|
||||||
field = rec._fields[key]
|
field = rec._fields[key]
|
||||||
old_value = field._get_stored_translations(rec).get(
|
stored_translation_rec = field._get_stored_translations(rec)
|
||||||
rec.env.lang, "en_US"
|
if not stored_translation_rec:
|
||||||
|
continue
|
||||||
|
old_value = (
|
||||||
|
stored_translation_rec.get(rec.env.lang or "en_US") or ""
|
||||||
)
|
)
|
||||||
if old_value.startswith("<p>") and old_value.endswith("</p>"):
|
if old_value.startswith("<p>") and old_value.endswith("</p>"):
|
||||||
old_value = old_value[3:-4]
|
old_value = old_value[3:-4]
|
||||||
|
|||||||
Reference in New Issue
Block a user