[IMP] web_widget_url_advanced: pre-commit auto fixes

pull/2918/head
Nedas Žilinskas 2024-05-27 14:51:00 +03:00 committed by Maksym Yankin
parent fc37294e76
commit c85c6ed415
11 changed files with 118 additions and 124 deletions

View File

@ -17,28 +17,28 @@ Web URL widget advanced
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3 :alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/15.0/web_widget_url_advanced :target: https://github.com/OCA/web/tree/17.0/web_widget_url_advanced
:alt: OCA/web :alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_widget_url_advanced :target: https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_widget_url_advanced
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=15.0 :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=17.0
:alt: Try me on Runboat :alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
Extend URL widget features to ease customization of anchor's text. Extend URL widget features to ease customization of anchor's text.
By default, the URL widget will show the plain URL. By default, the URL widget will show the plain URL. You can specify an
You can specify an attribute to provide a static label too. attribute to provide a static label too.
With this module, you can use a field for link's inner text using attribute With this module, you can use a field for link's inner text using
'text_field'. You can also add a prefix to the link using attribute attribute 'text_field'. You can also add a prefix to the link using
'prefix_name'. attribute 'prefix_name'.
Until 13.0 this functionality was separated in modules 'web_widget_url_advanced' Until 13.0 this functionality was separated in modules
and 'web_widget_prefixed_url' 'web_widget_url_advanced' and 'web_widget_prefixed_url'
**Table of contents** **Table of contents**
@ -48,50 +48,50 @@ and 'web_widget_prefixed_url'
Usage Usage
===== =====
Use `url` widget as you do usually, then add an extra parameter `text_field` Use url widget as you do usually, then add an extra parameter text_field
to indicate which field (present in the view already) must be used for the anchor text. to indicate which field (present in the view already) must be used for
the anchor text.
.. code:: xml
.. code-block:: xml <field name="some_url" widget="url" text_field="another_field" />
<field name="some_url" widget="url" text_field="another_field" /> M2O fields are supported: display_name is used automatically.
M2O fields are supported: `display_name` is used automatically. For example, in the partner form, if you want to display the website
link with partner's name as anchor you can do:
.. code:: xml
For example, in the partner form, <field name="website" widget="url" text_field="name" placeholder="e.g. www.odoo.com"/>
if you want to display the website link with partner's name as anchor you can do:
.. code-block:: xml
<field name="website" widget="url" text_field="name" placeholder="e.g. www.odoo.com"/>
This is going to change the rendering from This is going to change the rendering from
.. figure:: https://raw.githubusercontent.com/OCA/web/15.0/web_widget_url_advanced/static/description/before.png |image1|
to to
.. figure:: https://raw.githubusercontent.com/OCA/web/15.0/web_widget_url_advanced/static/description/after.png |image2|
Or user can add any hyperlink text using 'prefix_name' attribute Or user can add any hyperlink text using 'prefix_name' attribute
.. code-block:: xml .. code:: xml
<field name="skype_name" widget="url" 'prefix_name': 'skype'/> <field name="skype_name" widget="url" 'prefix_name': 'skype'/>
both can be applied inside the options attribute too: both can be applied inside the options attribute too:
.. code-block:: xml .. code:: xml
<field name="skype_name" widget="url" options="{'prefix_name': 'skype'}"/> <field name="skype_name" widget="url" options="{'prefix_name': 'skype'}"/>
.. |image1| image:: https://raw.githubusercontent.com/OCA/web/17.0/web_widget_url_advanced/static/description/before.png
.. |image2| image:: https://raw.githubusercontent.com/OCA/web/17.0/web_widget_url_advanced/static/description/after.png
Known issues / Roadmap Known issues / Roadmap
====================== ======================
* ``<field text_field="foo"/>`` is not supported in tree views. - ``<field text_field="foo"/>`` is not supported in tree views.
Bug Tracker Bug Tracker
=========== ===========
@ -99,7 +99,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_widget_url_advanced%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `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**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@ -107,25 +107,25 @@ Credits
======= =======
Authors Authors
~~~~~~~ -------
* Camptocamp * Camptocamp
Contributors Contributors
~~~~~~~~~~~~ ------------
* Simone Orsi <simone.orsi@camptocamp.com> - Simone Orsi <simone.orsi@camptocamp.com>
* `CorporateHub <https://corporatehub.eu/>`__ - `CorporateHub <https://corporatehub.eu/>`__
* Alexey Pelykh <alexey.pelykh@corphub.eu> - Alexey Pelykh <alexey.pelykh@corphub.eu>
* Jay Vora <jay.vora@serpentcs.com> - Jay Vora <jay.vora@serpentcs.com>
* Swapnesh Shah <s.shah.serpentcs@gmail.com> - Swapnesh Shah <s.shah.serpentcs@gmail.com>
* Joan Sisquella <joan.sisquella@forgeflow.com> - Joan Sisquella <joan.sisquella@forgeflow.com>
* Peerapong Supasompob <peerapong.supasompob@gmail.com> - Peerapong Supasompob <peerapong.supasompob@gmail.com>
Maintainers Maintainers
~~~~~~~~~~~ -----------
This module is maintained by the OCA. This module is maintained by the OCA.
@ -137,6 +137,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/web <https://github.com/OCA/web/tree/15.0/web_widget_url_advanced>`_ project on GitHub. This module is part of the `OCA/web <https://github.com/OCA/web/tree/17.0/web_widget_url_advanced>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"

View File

@ -0,0 +1,7 @@
- Simone Orsi \<<simone.orsi@camptocamp.com>\>
- [CorporateHub](https://corporatehub.eu/)
- Alexey Pelykh \<<alexey.pelykh@corphub.eu>\>
- Jay Vora \<<jay.vora@serpentcs.com>\>
- Swapnesh Shah \<<s.shah.serpentcs@gmail.com>\>
- Joan Sisquella \<<joan.sisquella@forgeflow.com>\>
- Peerapong Supasompob \<<peerapong.supasompob@gmail.com>\>

View File

@ -1,9 +0,0 @@
* Simone Orsi <simone.orsi@camptocamp.com>
* `CorporateHub <https://corporatehub.eu/>`__
* Alexey Pelykh <alexey.pelykh@corphub.eu>
* Jay Vora <jay.vora@serpentcs.com>
* Swapnesh Shah <s.shah.serpentcs@gmail.com>
* Joan Sisquella <joan.sisquella@forgeflow.com>
* Peerapong Supasompob <peerapong.supasompob@gmail.com>

View File

@ -0,0 +1,11 @@
Extend URL widget features to ease customization of anchor's text.
By default, the URL widget will show the plain URL. You can specify an
attribute to provide a static label too.
With this module, you can use a field for link's inner text using
attribute 'text_field'. You can also add a prefix to the link using
attribute 'prefix_name'.
Until 13.0 this functionality was separated in modules
'web_widget_url_advanced' and 'web_widget_prefixed_url'

View File

@ -1,11 +0,0 @@
Extend URL widget features to ease customization of anchor's text.
By default, the URL widget will show the plain URL.
You can specify an attribute to provide a static label too.
With this module, you can use a field for link's inner text using attribute
'text_field'. You can also add a prefix to the link using attribute
'prefix_name'.
Until 13.0 this functionality was separated in modules 'web_widget_url_advanced'
and 'web_widget_prefixed_url'

View File

@ -0,0 +1 @@
- `<field text_field="foo"/>` is not supported in tree views.

View File

@ -1 +0,0 @@
* ``<field text_field="foo"/>`` is not supported in tree views.

View File

@ -0,0 +1,36 @@
Use url widget as you do usually, then add an extra parameter text_field
to indicate which field (present in the view already) must be used for
the anchor text.
``` xml
<field name="some_url" widget="url" text_field="another_field" />
```
M2O fields are supported: display_name is used automatically.
For example, in the partner form, if you want to display the website
link with partner's name as anchor you can do:
``` xml
<field name="website" widget="url" text_field="name" placeholder="e.g. www.odoo.com"/>
```
This is going to change the rendering from
![](../static/description/before.png)
to
![](../static/description/after.png)
Or user can add any hyperlink text using 'prefix_name' attribute
``` xml
<field name="skype_name" widget="url" 'prefix_name': 'skype'/>
```
both can be applied inside the options attribute too:
``` xml
<field name="skype_name" widget="url" options="{'prefix_name': 'skype'}"/>
```

View File

@ -1,39 +0,0 @@
Use `url` widget as you do usually, then add an extra parameter `text_field`
to indicate which field (present in the view already) must be used for the anchor text.
.. code-block:: xml
<field name="some_url" widget="url" text_field="another_field" />
M2O fields are supported: `display_name` is used automatically.
For example, in the partner form,
if you want to display the website link with partner's name as anchor you can do:
.. code-block:: xml
<field name="website" widget="url" text_field="name" placeholder="e.g. www.odoo.com"/>
This is going to change the rendering from
.. figure:: ../static/description/before.png
to
.. figure:: ../static/description/after.png
Or user can add any hyperlink text using 'prefix_name' attribute
.. code-block:: xml
<field name="skype_name" widget="url" 'prefix_name': 'skype'/>
both can be applied inside the options attribute too:
.. code-block:: xml
<field name="skype_name" widget="url" options="{'prefix_name': 'skype'}"/>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
@ -369,15 +368,15 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c59446ba9b925182f7f539451bdc856f54709cb1c575d33698658f497c8872ba !! source digest: sha256:c59446ba9b925182f7f539451bdc856f54709cb1c575d33698658f497c8872ba
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/15.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-15-0/web-15-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=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p> <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>
<p>Extend URL widget features to ease customization of anchors text.</p> <p>Extend URL widget features to ease customization of anchors text.</p>
<p>By default, the URL widget will show the plain URL. <p>By default, the URL widget will show the plain URL. You can specify an
You can specify an attribute to provide a static label too.</p> attribute to provide a static label too.</p>
<p>With this module, you can use a field for links inner text using attribute <p>With this module, you can use a field for links inner text using
text_field. You can also add a prefix to the link using attribute attribute text_field. You can also add a prefix to the link using
prefix_name.</p> attribute prefix_name.</p>
<p>Until 13.0 this functionality was separated in modules web_widget_url_advanced <p>Until 13.0 this functionality was separated in modules
and web_widget_prefixed_url</p> web_widget_url_advanced and web_widget_prefixed_url</p>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents"> <div class="contents local topic" id="contents">
<ul class="simple"> <ul class="simple">
@ -394,25 +393,22 @@ and web_widget_prefixed_url</p>
</div> </div>
<div class="section" id="usage"> <div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1> <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>Use <cite>url</cite> widget as you do usually, then add an extra parameter <cite>text_field</cite> <p>Use url widget as you do usually, then add an extra parameter text_field
to indicate which field (present in the view already) must be used for the anchor text.</p> to indicate which field (present in the view already) must be used for
the anchor text.</p>
<pre class="code xml literal-block"> <pre class="code xml literal-block">
<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> <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>
</pre> </pre>
<p>M2O fields are supported: <cite>display_name</cite> is used automatically.</p> <p>M2O fields are supported: display_name is used automatically.</p>
<p>For example, in the partner form, <p>For example, in the partner form, if you want to display the website
if you want to display the website link with partners name as anchor you can do:</p> link with partners name as anchor you can do:</p>
<pre class="code xml literal-block"> <pre class="code xml literal-block">
<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> <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>
</pre> </pre>
<p>This is going to change the rendering from</p> <p>This is going to change the rendering from</p>
<div class="figure"> <p><img alt="image1" src="https://raw.githubusercontent.com/OCA/web/17.0/web_widget_url_advanced/static/description/before.png" /></p>
<img alt="https://raw.githubusercontent.com/OCA/web/15.0/web_widget_url_advanced/static/description/before.png" src="https://raw.githubusercontent.com/OCA/web/15.0/web_widget_url_advanced/static/description/before.png" />
</div>
<p>to</p> <p>to</p>
<div class="figure"> <p><img alt="image2" src="https://raw.githubusercontent.com/OCA/web/17.0/web_widget_url_advanced/static/description/after.png" /></p>
<img alt="https://raw.githubusercontent.com/OCA/web/15.0/web_widget_url_advanced/static/description/after.png" src="https://raw.githubusercontent.com/OCA/web/15.0/web_widget_url_advanced/static/description/after.png" />
</div>
<p>Or user can add any hyperlink text using prefix_name attribute</p> <p>Or user can add any hyperlink text using prefix_name attribute</p>
<pre class="code xml literal-block"> <pre class="code xml literal-block">
<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="err">'prefix_name':</span><span class="w"> </span><span class="err">'skype'</span><span class="nt">/&gt;</span> <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="err">'prefix_name':</span><span class="w"> </span><span class="err">'skype'</span><span class="nt">/&gt;</span>
@ -433,7 +429,7 @@ if you want to display the website link with partners name as anchor you can
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_widget_url_advanced%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <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>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@ -465,7 +461,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/15.0/web_widget_url_advanced">OCA/web</a> project on GitHub.</p> <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>
<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> <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>
</div> </div>
</div> </div>