[FIX] base,web: url widget: add protocol in href

With this commit, the url widget automatically prefixes the href
url by http:// if no protocol is specified, so that clicking on
the url will by default redirect to an external website.

To prevent this behavior, one can still specify the new option
'website_path: true' on the url field node in the view arch.

Thanks to this, we can remove a similar logic (only implemented on
res_partner model) which automatically altered the value saved in
database to force its 'http://' prefix.

task-2153184

closes odoo/odoo#42118

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Dhruv Patel
2020-01-30 14:03:36 +00:00
committed by Aaron Bohy
parent eec0b80756
commit d5d2c5524c
4 changed files with 48 additions and 19 deletions
+7 -2
View File
@@ -1733,8 +1733,6 @@ order.
This field displays an url (in readonly mode). The main reason to use it is
that it is rendered as an anchor tag with the proper css classes and href.
- Supported field types: *char*
Also, the text of the anchor tag can be customized with the *text* attribute
(it won't change the href value).
@@ -1742,6 +1740,13 @@ order.
<field name="foo" widget="url" text="Some URL"/>
Options:
- website_path: (default:false) by default, the widget forces (if not already
the case) the href value to begin with http:// except if this option is set
to true, thus allowing redirections to the database's own website.
- Supported field types: *char*
- domain (FieldDomain)
The "Domain" field allows the user to construct a technical-prefix domain