diff options
| author | Rémy Baranx (bar) <bar@odoo.com> | 2020-02-17 13:50:27 +0000 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2020-02-28 10:47:15 +0000 |
| commit | 7485177be1802893c8088c39a44447a183dae908 (patch) | |
| tree | f3265bd9c4d431f63339bbbe1ea568f3d4d63263 /addons/base_setup | |
| parent | ff3b2649f684271f2d920d3b77f92054f9f37bbc (diff) | |
[IMP] various: add documentation links in res.config
Purpose
=======
A 'book icon' link to the documentation of a feature has been
added in its settings panel, when it is useful (complex feature).
Add a nightly test that parses all the res_config_settings views
from the base one and checks that all documentation links are still valid.
Add the o_doc_link class to all documentation links to be able to easily
catch them if needed.
closes odoo/odoo#45813
Taskid: 2180574
Related: odoo/enterprise#8601
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Diffstat (limited to 'addons/base_setup')
| -rw-r--r-- | addons/base_setup/tests/__init__.py | 1 | ||||
| -rw-r--r-- | addons/base_setup/tests/test_res_config_doc_links.py | 57 | ||||
| -rw-r--r-- | addons/base_setup/views/res_config_settings_views.xml | 13 |
3 files changed, 69 insertions, 2 deletions
diff --git a/addons/base_setup/tests/__init__.py b/addons/base_setup/tests/__init__.py index 3916e5abd47..5c94e50e31c 100644 --- a/addons/base_setup/tests/__init__.py +++ b/addons/base_setup/tests/__init__.py @@ -2,3 +2,4 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import test_res_config +from . import test_res_config_doc_links diff --git a/addons/base_setup/tests/test_res_config_doc_links.py b/addons/base_setup/tests/test_res_config_doc_links.py new file mode 100644 index 00000000000..799ae411f9c --- /dev/null +++ b/addons/base_setup/tests/test_res_config_doc_links.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo.tests.common import HttpCase, tagged +import re + + +@tagged('nightly', 'post_install', '-at_install') +class TestResConfigDocLinks(HttpCase): + """ + Parse the 'res_config' view to extract all documentation links and + check that every links are still valid. + """ + + def setUp(self): + """ + Set-up the test environment + """ + super(TestResConfigDocLinks, self).setUp() + self.re = re.compile("<a href=\"(\S+/documentation/\S+)\"") + self.links = set() + + def test_01_links(self): + """ + Firs test: check that all documentation links in 'res_config_settings' + views are not broken. + """ + self._parse_view(self.env.ref('base.res_config_settings_view_form')) + + for link in self.links: + self._check_link(link) + + def _check_link(self, link): + """ + Try to open the link and check the response status code + """ + res = self.url_open(url=link) + + self.assertEqual( + res.status_code, 200, + "The following link is broken: '%s'" % (link) + ) + + def _parse_view(self, view): + """ + Analyse the view to extract documentation links and store them + in a set. + Then, parse its children if any. + """ + + # search the documentation links in the current view + for match in re.finditer(self.re, view.arch): + self.links.add(match.group(1)) + + # and then, search inside children + for child in view.inherit_children_ids: + self._parse_view(child) diff --git a/addons/base_setup/views/res_config_settings_views.xml b/addons/base_setup/views/res_config_settings_views.xml index e322ade86b8..d25eb521a5a 100644 --- a/addons/base_setup/views/res_config_settings_views.xml +++ b/addons/base_setup/views/res_config_settings_views.xml @@ -22,7 +22,7 @@ <span class='o_form_label' attrs="{'invisible':[('active_user_count', '<=', '1')]}"> Active Users </span> - + <a href="https://www.odoo.com/documentation/user/13.0/general/odoo_basics/add_user.html" title="Documentation" class="o_doc_link fa fa-lg fa-book" target="_blank"></a> <br/> <button name="%(base.action_res_users)d" icon="fa-arrow-right" type="action" string="Manage Users" class="btn-link o_web_settings_access_rights"/> @@ -80,6 +80,7 @@ <span class='o_form_label' attrs="{'invisible':[('language_count', '<=', '1')]}"> Languages </span> + <a href="https://www.odoo.com/documentation/user/13.0/general/odoo_basics/choose_language.html" title="Documentation" class="o_doc_link fa fa-lg fa-book" target="_blank"></a> </div> <div class="mt8"> <button name="%(base.res_lang_act_window)d" icon="fa-arrow-right" type="action" string="Manage Languages" class="btn-link"/> @@ -141,7 +142,11 @@ <div class="row mt16 o_settings_container" name="contacts_setting_container"> <div class="col-xs-12 col-md-6 o_setting_box" id="sms"> <div class="o_setting_right_pane" id="sms_settings"> - <div class="o_form_label">Send SMS</div> + <div class="o_form_label"> + Send SMS + <a href="https://www.odoo.com/documentation/user/13.0/sms_marketing/overview/integrations_and_template.html" title="Documentation" class="o_doc_link fa fa-lg fa-book" target="_blank"></a> + <a href="https://www.odoo.com/documentation/user/13.0/sms_marketing/pricing/pricing_and_faq.html" title="Documentation" class="o_doc_link fa fa-lg fa-book" target="_blank"></a> + </div> <div class="text-muted"> Send texts to your contacts </div> @@ -185,6 +190,7 @@ </div> <div class="o_setting_right_pane"> <label string="Import & Export" for="module_base_import"/> + <a href="https://www.odoo.com/documentation/user/13.0/general/base_import/import_faq.html" title="Documentation" class="o_doc_link fa fa-lg fa-book" target="_blank"></a> <div class="text-muted"> Allow users to import data from CSV/XLS/XLSX/ODS files </div> @@ -245,6 +251,7 @@ </div> <div class="o_setting_right_pane"> <label string="Google Calendar" for="module_google_calendar"/> + <a href="https://www.odoo.com/documentation/user/13.0/crm/optimize/google_calendar_credentials.html" title="Documentation" class="o_doc_link fa fa-lg fa-book" target="_blank"></a> <div class="text-muted"> Synchronize your calendar with Google Calendar </div> @@ -301,6 +308,7 @@ </div> <div class="o_setting_right_pane" name="auth_ldap_right_pane"> <label string="LDAP Authentication" for="module_auth_ldap"/> + <a href="https://www.odoo.com/documentation/user/13.0/general/auth/ldap.html" title="Documentation" class="o_doc_link fa fa-lg fa-book" target="_blank"></a> <div class="text-muted"> Use LDAP credentials to log in </div> @@ -329,6 +337,7 @@ </div> <div class="o_setting_right_pane" id="web_unsplash_settings"> <label for="module_web_unsplash"/> + <a href="https://www.odoo.com/documentation/user/13.0/general/unsplash/unsplash_access_key.html" title="Documentation" class="o_doc_link fa fa-lg fa-book" target="_blank"></a> <div class="text-muted"> Find free high-resolution images from Unsplash </div> |
