summaryrefslogtreecommitdiff
path: root/addons/test_mail_full
diff options
context:
space:
mode:
authorDharmraj Jhala <dja@odoo.com>2020-07-01 11:13:00 +0000
committerThibault Delavallée <tde@odoo.com>2020-07-27 07:27:18 +0000
commit0e57bfd45392fc2107e58aca8cd767c0c5c2c12e (patch)
treec7f2ccff14a8aed541e4d653efefd861be8c1bb4 /addons/test_mail_full
parentdafe96b3da12795506ddec9cc4d54e226af92a06 (diff)
[FIX] sms, test_mail_full: make contextual action work for sms templates
While creating contextual action for an sms template, the composition mode may be decided on the fly, based on number of records and on context the key `default_composition_mode`, which is set to 'guess'. It used to work before a recent refactoring[1], because the composition mode was changed in the default_get, and was being set to appropriate value instead of 'guess'. After this refactoring, the composition mode is not being set in the default_get but is being computed, so the key `default_composition_mode` tries to set the composition_mode selection field to 'guess', which is not available in the selection values, resulting into traceback. This commit fixes the issue by renaming the context key(removing 'default' prefix) to avoid setting the mode directly and instead let the compute method decide the composition mode based on context key and number of records. [1] - https://github.com/odoo/odoo/commit/e02137c48562d824e3e01054e31dae383e5843e2 TaskID - 2286959 closes odoo/odoo#54938 X-original-commit: 2b9ea3d93445e05cb0440aab33f2bf9e066b0fa5 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/test_mail_full')
-rw-r--r--addons/test_mail_full/tests/test_sms_composer.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/test_mail_full/tests/test_sms_composer.py b/addons/test_mail_full/tests/test_sms_composer.py
index cee5e969c1a..8a36d0ce2e5 100644
--- a/addons/test_mail_full/tests/test_sms_composer.py
+++ b/addons/test_mail_full/tests/test_sms_composer.py
@@ -519,7 +519,7 @@ class TestSMSComposerMass(TestMailFullCommon):
# Composer creation with context from a template context action (simulate) - comment (single recipient)
with self.with_user('employee'):
composer = self.env['sms.composer'].with_context(
- default_composition_mode='guess',
+ sms_composition_mode='guess',
default_res_ids=[test_record_2.id],
default_res_id=test_record_2.id,
active_ids=[test_record_2.id],
@@ -541,7 +541,7 @@ class TestSMSComposerMass(TestMailFullCommon):
# Composer creation with context from a template context action (simulate) - mass (multiple recipient)
with self.with_user('employee'):
composer = self.env['sms.composer'].with_context(
- default_composition_mode='guess',
+ sms_composition_mode='guess',
default_res_ids=[test_record_1.id, test_record_2.id],
default_res_id=test_record_1.id,
active_ids=[test_record_1.id, test_record_2.id],