Skip to content

Commit a4817a5

Browse files
committed
Merge PR OCA#3021 into 18.0
Signed-off-by StefanRijnhart
2 parents 98a1cfd + 2de76dc commit a4817a5

16 files changed

Lines changed: 792 additions & 0 deletions

File tree

web_widget_url_advanced/README.rst

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
=======================
2+
Web URL widget advanced
3+
=======================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:3596008f4a705be27d5f63123a0330ad2e83c021846d6fe34e6007e82d5988fe
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
18+
:alt: License: LGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
20+
:target: https://github.com/OCA/web/tree/18.0/web_widget_url_advanced
21+
:alt: OCA/web
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_widget_url_advanced
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
Extend URL, CopyClipboardURL widget features to ease customization of
32+
anchor's text.
33+
34+
By default, the URL, CopyClipboardURL widget will show the plain URL.
35+
You can specify an attribute to provide a static label too.
36+
37+
With this module, you can use a field for link's inner text using
38+
attribute 'text_field'. You can also add a prefix to the link using
39+
attribute 'prefix_name'.
40+
41+
Until 13.0 this functionality was separated in modules
42+
'web_widget_url_advanced' and 'web_widget_prefixed_url'
43+
44+
**Table of contents**
45+
46+
.. contents::
47+
:local:
48+
49+
Usage
50+
=====
51+
52+
Use url, CopyClipboardURL widget as you do usually, then add an extra
53+
parameter text\_ field to indicate which field (present in the view
54+
already) must be used for the anchor text.
55+
56+
.. code:: xml
57+
58+
<field name="some_url" widget="url" text_field="another_field" />
59+
60+
M2O fields are supported: display_name is used automatically.
61+
62+
For example, in the partner form, if you want to display the website
63+
link with partner's name as anchor you can do:
64+
65+
.. code:: xml
66+
67+
<field name="website" widget="url" text_field="name" placeholder="e.g. www.odoo.com"/>
68+
69+
This is going to change the rendering from
70+
71+
|image1|
72+
73+
to
74+
75+
|image2|
76+
77+
Or user can add any hyperlink text using 'prefix_name' attribute
78+
79+
.. code:: xml
80+
81+
<field name="skype_name" widget="url" prefix_name="skype"/>
82+
83+
both can be applied inside the options attribute too:
84+
85+
.. code:: xml
86+
87+
<field name="skype_name" widget="url" options="{'prefix_name': 'skype'}"/>
88+
89+
.. |image1| image:: https://raw.githubusercontent.com/OCA/web/18.0/web_widget_url_advanced/static/description/before.png
90+
.. |image2| image:: https://raw.githubusercontent.com/OCA/web/18.0/web_widget_url_advanced/static/description/after.png
91+
92+
Bug Tracker
93+
===========
94+
95+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
96+
In case of trouble, please check there if your issue has already been reported.
97+
If you spotted it first, help us to smash it by providing a detailed and welcomed
98+
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_widget_url_advanced%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
99+
100+
Do not contact contributors directly about support or help with technical issues.
101+
102+
Credits
103+
=======
104+
105+
Authors
106+
-------
107+
108+
* Camptocamp
109+
110+
Contributors
111+
------------
112+
113+
- Simone Orsi <simone.orsi@camptocamp.com>
114+
- `CorporateHub <https://corporatehub.eu/>`__
115+
116+
- Alexey Pelykh <alexey.pelykh@corphub.eu>
117+
118+
- Jay Vora <jay.vora@serpentcs.com>
119+
- Swapnesh Shah <s.shah.serpentcs@gmail.com>
120+
- Joan Sisquella <joan.sisquella@forgeflow.com>
121+
- Peerapong Supasompob <peerapong.supasompob@gmail.com>
122+
- Nedas Žilinskas <nedas.zilinskas@avoin.systems>
123+
- `Komit <https://komit-consulting.com>`__:
124+
125+
- Vang Nguyen Phu
126+
127+
Maintainers
128+
-----------
129+
130+
This module is maintained by the OCA.
131+
132+
.. image:: https://odoo-community.org/logo.png
133+
:alt: Odoo Community Association
134+
:target: https://odoo-community.org
135+
136+
OCA, or the Odoo Community Association, is a nonprofit organization whose
137+
mission is to support the collaborative development of Odoo features and
138+
promote its widespread use.
139+
140+
This module is part of the `OCA/web <https://github.com/OCA/web/tree/18.0/web_widget_url_advanced>`_ project on GitHub.
141+
142+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

web_widget_url_advanced/__init__.py

Whitespace-only changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2018 Simone Orsi - Camptocamp SA
2+
# License LGPLv3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html).
3+
{
4+
"name": "Web URL widget advanced",
5+
"summary": "This module extends URL widget "
6+
"for displaying anchors with custom labels.",
7+
"category": "Web",
8+
"version": "18.0.1.0.0",
9+
"license": "LGPL-3",
10+
"author": "Camptocamp, Odoo Community Association (OCA)",
11+
"website": "https://github.com/OCA/web",
12+
"depends": ["web"],
13+
"data": [],
14+
"assets": {
15+
"web.assets_backend": [
16+
"web_widget_url_advanced/static/src/fields/**/*",
17+
],
18+
},
19+
"installable": True,
20+
}

web_widget_url_advanced/i18n/es.po

Whitespace-only changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
#
4+
msgid ""
5+
msgstr ""
6+
"Project-Id-Version: Odoo Server 17.0\n"
7+
"Report-Msgid-Bugs-To: \n"
8+
"Last-Translator: \n"
9+
"Language-Team: \n"
10+
"MIME-Version: 1.0\n"
11+
"Content-Type: text/plain; charset=UTF-8\n"
12+
"Content-Transfer-Encoding: \n"
13+
"Plural-Forms: \n"

web_widget_url_advanced/i18n/zh_CN.po

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
- Simone Orsi \<<simone.orsi@camptocamp.com>\>
2+
- [CorporateHub](https://corporatehub.eu/)
3+
- Alexey Pelykh \<<alexey.pelykh@corphub.eu>\>
4+
- Jay Vora \<<jay.vora@serpentcs.com>\>
5+
- Swapnesh Shah \<<s.shah.serpentcs@gmail.com>\>
6+
- Joan Sisquella \<<joan.sisquella@forgeflow.com>\>
7+
- Peerapong Supasompob \<<peerapong.supasompob@gmail.com>\>
8+
- Nedas Žilinskas \<<nedas.zilinskas@avoin.systems>\>
9+
- [Komit](https://komit-consulting.com):
10+
- Vang Nguyen Phu
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Extend URL, CopyClipboardURL widget features to ease customization of anchor's text.
2+
3+
By default, the URL, CopyClipboardURL widget will show the plain URL. You can specify an
4+
attribute to provide a static label too.
5+
6+
With this module, you can use a field for link's inner text using
7+
attribute 'text_field'. You can also add a prefix to the link using
8+
attribute 'prefix_name'.
9+
10+
Until 13.0 this functionality was separated in modules
11+
'web_widget_url_advanced' and 'web_widget_prefixed_url'
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Use url, CopyClipboardURL widget as you do usually, then add an extra parameter text_
2+
field to indicate which field (present in the view already) must be used for
3+
the anchor text.
4+
5+
``` xml
6+
<field name="some_url" widget="url" text_field="another_field" />
7+
```
8+
9+
M2O fields are supported: display_name is used automatically.
10+
11+
For example, in the partner form, if you want to display the website
12+
link with partner's name as anchor you can do:
13+
14+
``` xml
15+
<field name="website" widget="url" text_field="name" placeholder="e.g. www.odoo.com"/>
16+
```
17+
18+
This is going to change the rendering from
19+
20+
![](../static/description/before.png)
21+
22+
to
23+
24+
![](../static/description/after.png)
25+
26+
Or user can add any hyperlink text using 'prefix_name' attribute
27+
28+
``` xml
29+
<field name="skype_name" widget="url" prefix_name="skype"/>
30+
```
31+
32+
both can be applied inside the options attribute too:
33+
34+
``` xml
35+
<field name="skype_name" widget="url" options="{'prefix_name': 'skype'}"/>
36+
```

0 commit comments

Comments
 (0)