Browse Source

fixup! [ADD] web_text_count_field

pull/1214/head
Alexandre Saunier 6 years ago
parent
commit
7ba9762a97
  1. 8
      web_text_count_field/README.rst
  2. 1
      web_text_count_field/__init__.py
  3. 1
      web_text_count_field/__manifest__.py
  4. 1
      web_text_count_field/models/__init__.py
  5. 14
      web_text_count_field/models/fields.py
  6. 3
      web_text_count_field/readme/DESCRIPTION.rst
  7. 5
      web_text_count_field/readme/USAGE.rst
  8. 7
      web_text_count_field/static/description/index.html

8
web_text_count_field/README.rst

@ -25,8 +25,7 @@ Web Textarea with Counter
|badge1| |badge2| |badge3| |badge4| |badge5|
Field ``TextCount``, combined to widget ``text_count``, is displayed as a usual
text field with a character counter next to it.
Widget ``text_count`` displays a character counter next to the text field.
**Table of contents**
@ -36,11 +35,6 @@ text field with a character counter next to it.
Usage
=====
.. code-block:: python
from odoo import fields
sometext = fields.TextCount('My Text', size=250)
.. code-block:: xml
<field name="text" widget="text_count" colspan="2"/>

1
web_text_count_field/__init__.py

@ -1 +0,0 @@
from . import models

1
web_text_count_field/__manifest__.py

@ -5,6 +5,7 @@
"category": "Web",
"version": "12.0.1.0.0",
"author": "Camptocamp SA, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web",
"license": "AGPL-3",
"depends": [
'web',

1
web_text_count_field/models/__init__.py

@ -1 +0,0 @@
from . import fields

14
web_text_count_field/models/fields.py

@ -1,14 +0,0 @@
# Copyright 2019 Camptocamp
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields
class TextCount(fields.Text):
def __init__(self, string, size=128, **kwargs):
assert size, "Size is mandatory in text_count field"
super().__init__(string=string, size=size, **kwargs)
fields.TextCount = TextCount

3
web_text_count_field/readme/DESCRIPTION.rst

@ -1,2 +1 @@
Field ``TextCount``, combined to widget ``text_count``, is displayed as a usual
text field with a character counter next to it.
Widget ``text_count`` displays a character counter next to the text field.

5
web_text_count_field/readme/USAGE.rst

@ -1,8 +1,3 @@
.. code-block:: python
from odoo import fields
sometext = fields.TextCount('My Text', size=250)
.. code-block:: xml
<field name="text" widget="text_count" colspan="2"/>

7
web_text_count_field/static/description/index.html

@ -368,8 +368,7 @@ ul.auto-toc {
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/web/tree/12.0/web_text_count_field"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_text_count_field"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/162/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>Field <tt class="docutils literal">TextCount</tt>, combined to widget <tt class="docutils literal">text_count</tt>, is displayed as a usual
text field with a character counter next to it.</p>
<p>Widget <tt class="docutils literal">text_count</tt> displays a character counter next to the text field.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
@ -385,10 +384,6 @@ text field with a character counter next to it.</p>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
<pre class="code python literal-block">
<span class="kn">from</span> <span class="nn">odoo</span> <span class="kn">import</span> <span class="n">fields</span>
<span class="n">sometext</span> <span class="o">=</span> <span class="n">fields</span><span class="o">.</span><span class="n">TextCount</span><span class="p">(</span><span class="s1">'My Text'</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">250</span><span class="p">)</span>
</pre>
<pre class="code xml literal-block">
<span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">&quot;text&quot;</span> <span class="na">widget=</span><span class="s">&quot;text_count&quot;</span> <span class="na">colspan=</span><span class="s">&quot;2&quot;</span><span class="nt">/&gt;</span>
</pre>

Loading…
Cancel
Save