diff options
| author | Thibault Delavallée <tde@odoo.com> | 2020-03-06 13:17:20 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-03-24 10:24:42 +0000 |
| commit | 2835e0ba38f67f76b7f43948290050dcc68cd9db (patch) | |
| tree | 369ae761539aca4cef909656cfd6e63b6d56af0c /addons/test_mail_full | |
| parent | 822f468059c9702b0898016e7bfbaf036a2c4036 (diff) | |
[MOV] mail, sms: move language computation in render mixin directly
PURPOSE
Merge rendering tools used in mail and sms templates as well as partially
in mailings and move them directly in mail.render.mixin.
SPECIFICATIONS
Move tools related to language computation from mail.template model to the
mail.render.mixin. It allows to update both
* mail.template: simply update calls accordingly;
* sms.template: remove code doing what is now available through mail.render
.mixin inherit;
Lang field is moved to mail.render.mixin as it is used notably for the language
computation. It therefore adds the field on mailing.mailing model although
not used currently.
LINKS
Task ID 1963529
Community PR odoo/odoo#32397
Diffstat (limited to 'addons/test_mail_full')
| -rw-r--r-- | addons/test_mail_full/tests/test_sms_template.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/addons/test_mail_full/tests/test_sms_template.py b/addons/test_mail_full/tests/test_sms_template.py index a39edf8545f..d688b30d0f7 100644 --- a/addons/test_mail_full/tests/test_sms_template.py +++ b/addons/test_mail_full/tests/test_sms_template.py @@ -50,18 +50,20 @@ class TestSmsTemplate(test_mail_full_common.TestSMSCommon, test_mail_full_common self.assertEqual(self.sms_template.body, self.body_en) self.assertEqual(self.sms_template.with_context(lang='fr_FR').body, self.body_fr) - rid_to_tpl = self.sms_template._get_context_lang_per_id((self.test_record | test_record_2).ids) - self.assertEqual(set(rid_to_tpl.keys()), set((self.test_record | test_record_2).ids)) - for rid, tpl in rid_to_tpl.items(): + rid_to_lang = self.sms_template._render_lang((self.test_record | test_record_2).ids) + self.assertEqual(set(rid_to_lang.keys()), set((self.test_record | test_record_2).ids)) + for rid, lang in rid_to_lang.items(): + # TDE FIXME: False or en_US ? if rid == self.test_record.id: - self.assertEqual(tpl._context.get('lang'), 'en_US') + self.assertEqual(lang, 'en_US') elif rid == test_record_2.id: - self.assertEqual(tpl._context.get('lang'), 'fr_FR') + self.assertEqual(lang, 'fr_FR') else: self.assertTrue(False) - lang_to_rids = self.sms_template._get_ids_per_lang((self.test_record | test_record_2).ids) - for lang, rids in lang_to_rids.items(): + tpl_to_rids = self.sms_template._classify_per_lang((self.test_record | test_record_2).ids) + for lang, (tpl, rids) in tpl_to_rids.items(): + # TDE FIXME: False or en_US ? if lang == 'en_US': self.assertEqual(rids, self.test_record.ids) elif lang == 'fr_FR': @@ -87,4 +89,3 @@ class TestSmsTemplate(test_mail_full_common.TestSMSCommon, test_mail_full_common self.sms_template.unlink() self.assertEqual(ActWindow.search_count([('id', '=', action_id)]), 0) - |
