diff options
| author | Thibault Delavallée <tde@odoo.com> | 2018-12-04 12:01:45 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2019-01-14 15:22:18 +0000 |
| commit | b74252dd1d2a38aae0ee969f443fac342e8e9f74 (patch) | |
| tree | 7b3dbe9e38ced5d90136f585655fad232e0d5133 /addons/survey/tests | |
| parent | ee2631cd514d8339d40dbab38b714371c428ff7b (diff) | |
[REF] survey: clean models by removing unnecessary fields
This commit holds several improvements on survey models.
[IMP] re-order fields in survey models and update strings / helps
Purpose is to ease understanding and future modifications of survey models
by reordering fields in survey, question and user input models. Those are the
main models we want to clean in future updates.
Some comments have been moved into help and some labels and helps have been
updated to clarify a bit the use of various fields, notably in question model.
No functional or technical change occur with this commit. It is just pure
code move. Reordering them allow to already understand a bit more the logic
of this module.
[REF] survey: remove unnecessary/unused fields on answer models
Purpose of this commit is to remove unnecessary and/or unused fields on survey
answer line model. In this commit we
* remove useless date_create field on answer and answer lines models. This
field is basically a renamed create_date. Let us remove this dummy field
as it adds nothing to the answer and answer lines models;
* remove useless URL-related fields and actions on answer and answer lines
models. Having those fields actually bloats the model without really helping
understanding survey models. As changing routes should not occur frequently
hiding routes in fields does not really help. Templates are update to
directly include links instead of fields;
We also remove a button on user input that redirects to the survey global
results. Surveys results are available on survey kanban and form views. It
makes no sense to have that kind of button on a specific answer.
[REF] survey: remove unnecessary/unused fields on survey models
Purpose of this commit is to remove unnecessary and/or unused fields on survey
model. In this commit we
* remove useless is_designed field on survey model. We remove is_designed
field that is based on having page and/or questions. It is just used to
make some links inactive in kanban view. Having fields just for that
purpose bloats the model and is not necessary. Testing void surveys will
just lead to a void page;
* remove useless email_template_id field on survey model. This field is
completely not used anywhere in survey codebase;
* remove useless urls field in survey model. In this commit we remove support
of both relative and global urls computation. It was used only in invite
wizard but was actually not really necessary as knowing the survey access
url is the only really necessary thing to display;
* Print and results URLs are removed from survey model. Having them inlined
directly in code is simpler that actually hiding them behind field. As
changing routes should not occur often it is not a big deal to write them
when necessary. We therefore remove public_url_html, print_url and
result_url fields;
This commit is linked to task ID 1911586 and PR #28986.
Diffstat (limited to 'addons/survey/tests')
| -rw-r--r-- | addons/survey/tests/test_survey.py | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/addons/survey/tests/test_survey.py b/addons/survey/tests/test_survey.py index 0ce7c5d612d..b962a4fa1dd 100644 --- a/addons/survey/tests/test_survey.py +++ b/addons/survey/tests/test_survey.py @@ -175,19 +175,3 @@ class TestSurveyInternals(common.SurveyCase): result = self.env['survey.survey'].prepare_result(question) for key in exresult: self.assertEqual(result[key], exresult[key]) - - @users('survey_manager') - def test_survey_urls(self): - base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') - urltypes = {'public': 'start', 'print': 'print', 'result': 'results'} - for urltype, urltxt in urltypes.items(): - survey_url = getattr(self.survey, urltype + '_url') - survey_url_relative = getattr(self.survey.with_context({'relative_url': True}), urltype + '_url') - url = "survey/%s/%s" % (urltxt, slug(self.survey)) - full_url = urls.url_join(base_url, url) - self.assertEqual(full_url, survey_url) - self.assertEqual('/' + url, survey_url_relative) - if urltype == 'public': - url_html = '<a href="%s">Click here to start survey</a>' - self.assertEqual(url_html % full_url, getattr(self.survey, urltype + '_url_html'), msg="Public URL is incorrect") - self.assertEqual(url_html % ('/' + url), getattr(self.survey.with_context({'relative_url': True}), urltype + '_url_html')) |
