Skip to content

Commit

Permalink
Merge PR #2002 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by rafaelbn
  • Loading branch information
OCA-git-bot committed Jan 13, 2025
2 parents 64b0df1 + c3b4036 commit 6a042df
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,20 @@ def test_update_taxes_with_english_deactivate(self):
lang_model = self.env["res.lang"]
lang_model.search([("code", "=", "en_US")]).write({"active": False})
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)
7 changes: 5 additions & 2 deletions account_chart_update_multilang/wizards/wizard_chart_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ def _update_other_langs(self, templates):
for key in self._diff_translate_fields(template, rec):
for lang in self._other_langs():
field = rec._fields[key]
old_value = field._get_stored_translations(rec).get(
rec.env.lang, "en_US"
stored_translation_rec = field._get_stored_translations(rec)
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>"):
old_value = old_value[3:-4]
Expand Down

0 comments on commit 6a042df

Please sign in to comment.