Search 1.9 billion lines of Odoo code on GitHub

web_widget_float_highlight

Author: Onestein
License: AGPL-3
Branch: 10.0
Repository: a0c/addons-onestein
Dependencies: base, and web
Languages: JavaScript (205, 70.7%), Python (13, 4.5%), XML (9, 3.1%), and reStructuredText (63, 21.7%)
Other branches: 9.0
Other repositories: AEK-BKF/addons-onestein, AhmedHasan1991/addons-onestein, ArnulfoSepulveda/addons-onestein, CLVsol/addons-onestein, Callino/addons-onestein, Gofekra/addons-onestein, HarshalBhoir/addons-onestein, Hayyan-Ebrahem/addons-onestein, ICTSTUDIO/addons-onestein, JohnLYH/addons-onestein, LevelPrime/addons-onestein, Nkirui/addons-onestein, Nucleoos/addons-onestein, OdooBulgaria/addons-onestein, PrenorSistemas/addons-onestein, RL-OtherApps/addons-onestein, RealSolutionsLux/addons-onestein, VitalPet/addons-onestein, aaltinisik/addons-onestein, adriansteel/addons-onestein, alangwansui/addons-onestein, anodino-dev/addons-onestein, aravinthu/addons-onestein, aurestic/addons-onestein, aymanshow/addons-onestein, bcang/addons-onestein, brain-tec/addons-onestein, cameroun/addons-onestein, camptocamp/addons-onestein, diagramsoftware/addons-onestein, elperrofarelo/addons-onestein, eqms/addons-onestein, eribowo/addons-onestein, focusate/addons-onestein, gfcapalbo/addons-onestein, grant-thornton/addons-onestein, guewen/addons-onestein, gurneyalex/addons-onestein, haryoran04/addons-onestein, iCivic/addons-onestein, inforpordev/addons-onestein, izzihector/addons-onestein, jimhoefnagels/addons-onestein, jlzhou/addons-onestein, junusd/addons-onestein, kenvac/addons-onestein, kikopeiro/addons-onestein, leodoooca/addons-onestein, levkar/addons-onestein, lnkdel/addons-onestein, luca-vercelli/addons-onestein, marcelsavegnago/addons-onestein, maurolguin1/addons-onestein, minhhq09/addons-onestein, mulaudzicalvin/addons-onestein, nick2474/addons-onestein, niulinlnc/addons-onestein, nvq247/addons-onestein, odof/addons-onestein, odoofans/addons-onestein, omarlemorac/addons-onestein, one2pret/addons-onestein, onesteinbv/addons-onestein, openmes/addons-onestein, robotiko/addons-onestein, royalline1/addons-onestein, sc4you/addons-onestein, scbrianti/addons-onestein, shouyejing/addons-onestein, sunflowerit/addons-onestein, taifu/addons-onestein, tekcloud/addons-onestein, thinkwelltwd/addons-onestein, tholenstein/addons-onestein, tschanzt/addons-onestein, tusharkwagh99/addons-onestein, ursais/addons-onestein, vcloud9ray/addons-onestein, vidtsin/addons-onestein, westlyou/addons-onestein, yasmanycastillo/addons-onestein, and yasserkaddour/addons-onestein

<a class="reference external image-reference" 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.svg"> </a> <a name="highlight-float-field"></a> <h2>Highlight Float Field</h2> <p>This module extends the functionality of web backend to allow user to highlight any numeric field when its value belongs to a given interval, both in form and pivot views.</p> <div class="figure"> <img alt="Example of highlight for positive and negative numbers." src="static/description/widget_highlight_screenshot-1.png" /> </div> <a name="usage"></a> <h3>Usage</h3> <p>For working, this module defines 3 distinct numeric intervals separated by two values which are called thresholds. If we call T1 and T2 the two thresholds, assuming that T1 &lt;= T2, the three intervals are so defined:</p> <ul class="simple"> <li>Lower: each number &lt; T1;</li> <li>Middle: each number included between T1 and T2 (including T1 and T2 as well);</li> <li>Upper: each number &gt; T2;</li> </ul> <p>For each of these intervals is setted a background-color and a text-color; for numeric fields which use the highlight functionality, whenever their value belongs to one of these three intervals, it's shown with the interval-related color combination.</p> <p>By default, T1 and T2 are set to 0, the lower-interval colors are red/white; the middle-interval colors are white/grey and the upper interval colors are green/white. Therefore, by default, a numeric field with this option has a red background (with white text) if it's a negative number, a green background (with white text) if it's a positive number and keep the basic odoo style if it's equal to 0. By default, the highlight works only when the form view is not in edit mode.</p> <p>To use the default settings, you have to enable them setting the option 'load_defaults' to True on a numeric field.</p> <blockquote> &lt;field name=&quot;my_numeric_field&quot; options=&quot;{'load_defaults':True}&quot;/&gt;</blockquote> <p>Anyway it's possible to customize this behavior through several options you can provide to the field. Such options are:</p> <ul class="simple"> <li>lower_threshold (0 by default): T1, the lowest number into middle-interval;</li> <li>upper_threshold (0 by default): T2, the highest number into middle-interval;</li> <li>lower_bg_color (red by default): Background-color for lower-interval;</li> <li>middle_bg_color (white by default): Background-color for middle-interval;</li> <li>upper_bg_color (green by default): Background-color for upper-interval;</li> <li>lower_font_color (white by default): Text-color for lower-interval;</li> <li>middle_font_color (grey - by default): Text-color for middle-interval;</li> <li>upper_font_color (white by default): Text-color for upper-interval;</li> <li>always_work (False by default): If True the highlight works also in edit mode;</li> </ul> <p>Be also aware that if you don't set the 'load_defaults' flag to True, the default colors won't be loaded (therefore the field would be shown with the Odoo standar style) but you can still provide any other option to customize its behavior according to your wishes.</p> <div class="figure"> <img alt="Example of highlight for positive and negative numbers." src="static/description/widget_highlight_screenshot-2.png" /> </div> <p>To avoid errors, don't use garbage values for the options above. In particular, be aware that the function won't work if T1 &gt; T2.</p> <hr class="docutils" /> <p>It's also possible to highlight numeric cells in a pivot view, following similar rules. To do so, provide the options above in the definition of the pivot itself. This rule will be then loaded for the whole view.</p> <blockquote> &lt;pivot string=&quot;My Pivot View&quot; options='{&quot;load_defaults&quot;:&quot;true&quot;}'&gt;</blockquote> <p>To choose on which column to enable this functionality, then, set on the wished 'measure' numeric field, the attribute 'highlight'.</p> <blockquote> &lt;field name=&quot;my_numeric_field&quot; type=&quot;measure&quot; highlight=&quot;true&quot;/&gt;</blockquote> <a name="known-issues-roadmap"></a> <h3>Known issues / Roadmap</h3> <p>It's under analysis the improvement of this module. The idea is to condition the highlight of a field to a more general condition than the mere belonging to an interval. In order to achieve this, it's necessary to provide the user a tool to write its own conditions.</p> <a name="credits"></a> <h3 class="with-subtitle">Credits</h3> <h3 class="section-subtitle" id="contributors"><span class="section-subtitle">Contributors</span></h3> <ul class="simple"> <li>Antonio Esposito &lt;<a class="reference external" href="mailto:a.esposito&#64;onestein.nl">a.esposito&#64;onestein.nl</a>&gt;</li> </ul>