Skip to content

Commit c8d874b

Browse files
[MIG] web_widget_url_advanced: Migration to 18.0
1 parent 0129157 commit c8d874b

File tree

7 files changed

+59
-39
lines changed

7 files changed

+59
-39
lines changed

web_widget_url_advanced/README.rst

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,22 @@ Web URL widget advanced
1717
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
1818
:alt: License: LGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
20-
:target: https://github.com/OCA/web/tree/17.0/web_widget_url_advanced
20+
:target: https://github.com/OCA/web/tree/18.0/web_widget_url_advanced
2121
:alt: OCA/web
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_widget_url_advanced
23+
:target: https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_widget_url_advanced
2424
:alt: Translate me on Weblate
2525
.. |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=17.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=18.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
3030

31-
Extend URL widget features to ease customization of anchor's text.
31+
Extend URL, CopyClipboardURL widget features to ease customization of
32+
anchor's text.
3233

33-
By default, the URL widget will show the plain URL. You can specify an
34-
attribute to provide a static label too.
34+
By default, the URL, CopyClipboardURL widget will show the plain URL.
35+
You can specify an attribute to provide a static label too.
3536

3637
With this module, you can use a field for link's inner text using
3738
attribute 'text_field'. You can also add a prefix to the link using
@@ -48,9 +49,9 @@ Until 13.0 this functionality was separated in modules
4849
Usage
4950
=====
5051

51-
Use url widget as you do usually, then add an extra parameter text_field
52-
to indicate which field (present in the view already) must be used for
53-
the anchor text.
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.
5455

5556
.. code:: xml
5657
@@ -85,16 +86,16 @@ both can be applied inside the options attribute too:
8586
8687
<field name="skype_name" widget="url" options="{'prefix_name': 'skype'}"/>
8788
88-
.. |image1| image:: https://raw.githubusercontent.com/OCA/web/17.0/web_widget_url_advanced/static/description/before.png
89-
.. |image2| image:: https://raw.githubusercontent.com/OCA/web/17.0/web_widget_url_advanced/static/description/after.png
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
9091

9192
Bug Tracker
9293
===========
9394

9495
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
9596
In case of trouble, please check there if your issue has already been reported.
9697
If you spotted it first, help us to smash it by providing a detailed and welcomed
97-
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_widget_url_advanced%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
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**>`_.
9899

99100
Do not contact contributors directly about support or help with technical issues.
100101

@@ -109,16 +110,19 @@ Authors
109110
Contributors
110111
------------
111112

112-
- Simone Orsi <simone.orsi@camptocamp.com>
113-
- `CorporateHub <https://corporatehub.eu/>`__
113+
- Simone Orsi <simone.orsi@camptocamp.com>
114+
- `CorporateHub <https://corporatehub.eu/>`__
114115

115-
- Alexey Pelykh <alexey.pelykh@corphub.eu>
116+
- Alexey Pelykh <alexey.pelykh@corphub.eu>
116117

117-
- Jay Vora <jay.vora@serpentcs.com>
118-
- Swapnesh Shah <s.shah.serpentcs@gmail.com>
119-
- Joan Sisquella <joan.sisquella@forgeflow.com>
120-
- Peerapong Supasompob <peerapong.supasompob@gmail.com>
121-
- Nedas Žilinskas <nedas.zilinskas@avoin.systems>
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
122126

123127
Maintainers
124128
-----------
@@ -133,6 +137,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
133137
mission is to support the collaborative development of Odoo features and
134138
promote its widespread use.
135139

136-
This module is part of the `OCA/web <https://github.com/OCA/web/tree/17.0/web_widget_url_advanced>`_ project on GitHub.
140+
This module is part of the `OCA/web <https://github.com/OCA/web/tree/18.0/web_widget_url_advanced>`_ project on GitHub.
137141

138142
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

web_widget_url_advanced/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"summary": "This module extends URL widget "
66
"for displaying anchors with custom labels.",
77
"category": "Web",
8-
"version": "17.0.1.0.0",
8+
"version": "18.0.1.0.0",
99
"license": "LGPL-3",
1010
"author": "Camptocamp, Odoo Community Association (OCA)",
1111
"website": "https://github.com/OCA/web",

web_widget_url_advanced/readme/CONTRIBUTORS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@
66
- Joan Sisquella \<<joan.sisquella@forgeflow.com>\>
77
- Peerapong Supasompob \<<peerapong.supasompob@gmail.com>\>
88
- Nedas Žilinskas \<<nedas.zilinskas@avoin.systems>\>
9+
- [Komit](https://komit-consulting.com):
10+
- Vang Nguyen Phu

web_widget_url_advanced/readme/DESCRIPTION.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
Extend URL widget features to ease customization of anchor's text.
1+
Extend URL, CopyClipboardURL widget features to ease customization of anchor's text.
22

3-
By default, the URL widget will show the plain URL. You can specify an
3+
By default, the URL, CopyClipboardURL widget will show the plain URL. You can specify an
44
attribute to provide a static label too.
55

66
With this module, you can use a field for link's inner text using

web_widget_url_advanced/readme/USAGE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Use url widget as you do usually, then add an extra parameter text_field
2-
to indicate which field (present in the view already) must be used for
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
33
the anchor text.
44

55
``` xml

web_widget_url_advanced/static/description/index.html

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,11 @@ <h1 class="title">Web URL widget advanced</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:3596008f4a705be27d5f63123a0330ad2e83c021846d6fe34e6007e82d5988fe
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/17.0/web_widget_url_advanced"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_widget_url_advanced"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373-
<p>Extend URL widget features to ease customization of anchor’s text.</p>
374-
<p>By default, the URL widget will show the plain URL. You can specify an
375-
attribute to provide a static label too.</p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/18.0/web_widget_url_advanced"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_widget_url_advanced"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373+
<p>Extend URL, CopyClipboardURL widget features to ease customization of
374+
anchor’s text.</p>
375+
<p>By default, the URL, CopyClipboardURL widget will show the plain URL.
376+
You can specify an attribute to provide a static label too.</p>
376377
<p>With this module, you can use a field for link’s inner text using
377378
attribute ‘text_field’. You can also add a prefix to the link using
378379
attribute ‘prefix_name’.</p>
@@ -393,9 +394,9 @@ <h1 class="title">Web URL widget advanced</h1>
393394
</div>
394395
<div class="section" id="usage">
395396
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
396-
<p>Use url widget as you do usually, then add an extra parameter text_field
397-
to indicate which field (present in the view already) must be used for
398-
the anchor text.</p>
397+
<p>Use url, CopyClipboardURL widget as you do usually, then add an extra
398+
parameter text_ field to indicate which field (present in the view
399+
already) must be used for the anchor text.</p>
399400
<pre class="code xml literal-block">
400401
<span class="nt">&lt;field</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;some_url&quot;</span><span class="w"> </span><span class="na">widget=</span><span class="s">&quot;url&quot;</span><span class="w"> </span><span class="na">text_field=</span><span class="s">&quot;another_field&quot;</span><span class="w"> </span><span class="nt">/&gt;</span>
401402
</pre>
@@ -406,9 +407,9 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
406407
<span class="nt">&lt;field</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;website&quot;</span><span class="w"> </span><span class="na">widget=</span><span class="s">&quot;url&quot;</span><span class="w"> </span><span class="na">text_field=</span><span class="s">&quot;name&quot;</span><span class="w"> </span><span class="na">placeholder=</span><span class="s">&quot;e.g. www.odoo.com&quot;</span><span class="nt">/&gt;</span>
407408
</pre>
408409
<p>This is going to change the rendering from</p>
409-
<p><img alt="image1" src="https://raw.githubusercontent.com/OCA/web/17.0/web_widget_url_advanced/static/description/before.png" /></p>
410+
<p><img alt="image1" src="https://raw.githubusercontent.com/OCA/web/18.0/web_widget_url_advanced/static/description/before.png" /></p>
410411
<p>to</p>
411-
<p><img alt="image2" src="https://raw.githubusercontent.com/OCA/web/17.0/web_widget_url_advanced/static/description/after.png" /></p>
412+
<p><img alt="image2" src="https://raw.githubusercontent.com/OCA/web/18.0/web_widget_url_advanced/static/description/after.png" /></p>
412413
<p>Or user can add any hyperlink text using ‘prefix_name’ attribute</p>
413414
<pre class="code xml literal-block">
414415
<span class="nt">&lt;field</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;skype_name&quot;</span><span class="w"> </span><span class="na">widget=</span><span class="s">&quot;url&quot;</span><span class="w"> </span><span class="na">prefix_name=</span><span class="s">&quot;skype&quot;</span><span class="nt">/&gt;</span>
@@ -423,7 +424,7 @@ <h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
423424
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
424425
In case of trouble, please check there if your issue has already been reported.
425426
If you spotted it first, help us to smash it by providing a detailed and welcomed
426-
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_widget_url_advanced%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
427+
<a class="reference external" href="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**">feedback</a>.</p>
427428
<p>Do not contact contributors directly about support or help with technical issues.</p>
428429
</div>
429430
<div class="section" id="credits">
@@ -447,6 +448,10 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
447448
<li>Joan Sisquella &lt;<a class="reference external" href="mailto:joan.sisquella&#64;forgeflow.com">joan.sisquella&#64;forgeflow.com</a>&gt;</li>
448449
<li>Peerapong Supasompob &lt;<a class="reference external" href="mailto:peerapong.supasompob&#64;gmail.com">peerapong.supasompob&#64;gmail.com</a>&gt;</li>
449450
<li>Nedas Žilinskas &lt;<a class="reference external" href="mailto:nedas.zilinskas&#64;avoin.systems">nedas.zilinskas&#64;avoin.systems</a>&gt;</li>
451+
<li><a class="reference external" href="https://komit-consulting.com">Komit</a>:<ul>
452+
<li>Vang Nguyen Phu</li>
453+
</ul>
454+
</li>
450455
</ul>
451456
</div>
452457
<div class="section" id="maintainers">
@@ -458,7 +463,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
458463
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
459464
mission is to support the collaborative development of Odoo features and
460465
promote its widespread use.</p>
461-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/17.0/web_widget_url_advanced">OCA/web</a> project on GitHub.</p>
466+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/18.0/web_widget_url_advanced">OCA/web</a> project on GitHub.</p>
462467
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
463468
</div>
464469
</div>

web_widget_url_advanced/static/src/fields/url_field.esm.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ License LGPLv3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html). */
55

66
import {patch} from "@web/core/utils/patch";
77
import {UrlField, formUrlField, urlField} from "@web/views/fields/url/url_field";
8+
import {copyClipboardURLField} from "@web/views/fields/copy_clipboard/copy_clipboard_field";
89

9-
patch(UrlField.props, {
10+
const AdvancedUrlFieldProps = {
1011
text_field: {type: String, optional: true},
1112
prefix_name: {type: String, optional: true},
12-
});
13+
};
14+
15+
patch(UrlField.props, AdvancedUrlFieldProps);
16+
patch(copyClipboardURLField.component.props, AdvancedUrlFieldProps);
1317

1418
patch(UrlField.prototype, {
1519
_get_text_field() {
@@ -48,9 +52,14 @@ const patchExtractProps = {
4852
const props = super.extractProps(...arguments);
4953
props.text_field = attrs.text_field || options.text_field;
5054
props.prefix_name = attrs.prefix_name || options.prefix_name;
55+
if (this.component.name !== "CopyClipboardURLField") {
56+
delete props.string;
57+
delete props.disabledExpr;
58+
}
5159
return props;
5260
},
5361
};
5462

5563
patch(urlField, patchExtractProps);
5664
patch(formUrlField, patchExtractProps);
65+
patch(copyClipboardURLField, patchExtractProps);

0 commit comments

Comments
 (0)