Skip to content
Snippets Groups Projects
Unverified Commit d84b795b authored by Martin Trigaux's avatar Martin Trigaux
Browse files

[ADD] test_translation_import: new no update test

To verify the translations are indeed not overwritten
parent 1703a2f8
No related branches found
No related tags found
No related merge requests found
......@@ -13,3 +13,20 @@ class TestTermCount(common.TransactionCase):
ids = self.env['ir.translation'].search(
[('src', '=', '1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB')])
self.assertEqual(len(ids), 2)
def test_noupdate(self):
"""
Make sure no update do not overwrite translations
"""
menu = self.env.ref('test_translation_import.menu_test_translation_import')
menu.name = "New Name"
# install french and change translation content
odoo.tools.trans_load(self.cr, 'test_translation_import/i18n/fr.po', 'fr_FR', verbose=False)
menu.with_context(lang='fr_FR').name = "Nouveau nom"
# reload with overwrite
odoo.tools.trans_load(self.cr, 'test_translation_import/i18n/fr.po', 'fr_FR', verbose=False, context={'overwrite': True})
# trans_load invalidates ormcache but not record cache
menu.refresh()
self.assertEqual(menu.name, "New Name")
self.assertEqual(menu.with_context(lang='fr_FR').name, "Nouveau nom")
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<data noupdate="1">
<record id="action_test_translation_import" model="ir.actions.act_window">
<field name="name">Test translation import</field>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment