From beefba72014359d5984a27294b85276753a4e222 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Tue, 18 Feb 2014 19:08:31 +0100 Subject: [PATCH] Add module web_field_float_compute to integrate in we-addons repository. --- web_field_float_compute/__init__.py | 4 + web_field_float_compute/__openerp__.py | 64 +++++++++ .../static/src/img/icon.png | Bin 0 -> 3262 bytes .../static/src/js/models.js | 132 ++++++++++++++++++ 4 files changed, 200 insertions(+) create mode 100644 web_field_float_compute/__init__.py create mode 100644 web_field_float_compute/__openerp__.py create mode 100644 web_field_float_compute/static/src/img/icon.png create mode 100644 web_field_float_compute/static/src/js/models.js diff --git a/web_field_float_compute/__init__.py b/web_field_float_compute/__init__.py new file mode 100644 index 00000000..97833ca3 --- /dev/null +++ b/web_field_float_compute/__init__.py @@ -0,0 +1,4 @@ +# -*- encoding: utf-8 -*- +################################################################################ +# See __openerp__.py file for Copyright and Licence Informations. +################################################################################ diff --git a/web_field_float_compute/__openerp__.py b/web_field_float_compute/__openerp__.py new file mode 100644 index 00000000..4e70ec39 --- /dev/null +++ b/web_field_float_compute/__openerp__.py @@ -0,0 +1,64 @@ +# -*- encoding: utf-8 -*- +################################################################################ +# See Copyright and Licence Informations undermentioned. +################################################################################ +{ + 'name': 'Mathematic Formulas in Float fields', + 'version': '1.0', + 'category': 'web', + 'description': """ +Allow to write simple mathematic formules in Integer / Float fields +=================================================================== + +Functionnalities : +------------------ + * Possibility to tip a text like "=45 + 4/3 - 5 * (2 +1)" ; + * if the formula is correct, The result will be computed and displayed ; + * if the formula is not correct, the initial text is displayed ; + +Documentations : +------------------ + * Video : http://www.youtube.com/watch?v=jQGdD34WYrA&hd=1 + +Technical informations : +------------------------ + * Overloads "instance.web.form.FieldFloat" ; (so works for fields.integer & fields.float) ; + * To compute, the module simply use the eval() javascript function ; + * Rounding computation is not done by this module (The module has the same behaviour if the user tips "=1/3" or if he tips "0.33[...]") ; + * avoid code injonction by regexpr test : "=alert('security')" is not valid ; + +Limits : +-------- + * Only supports the four operators : "+" "-" "*" "/" and parenthesis ; + +Copyright and Licence : +----------------------- + * 2013, Groupement Régional Alimentaire de Proximité (http://www.grap.coop/) + * Licence : AGPL-3 (http://www.gnu.org/licenses/) + +Contacts : +---------- + * Sylvain LE GAL (https://twitter.com/legalsylvain); + * for any help or question about this module. + """, + 'author': 'GRAP', + 'website': 'http://www.grap.coop', + 'license': 'AGPL-3', + 'depends': [ + 'web', + ], + 'init_xml': [], + 'update_xml': [], + 'demo_xml': [], + 'js': [ + 'static/src/js/models.js', + ], + 'css': [], + 'qweb': [], + 'images': [], + 'post_load': '', + 'application': False, + 'installable': True, + 'auto_install': False, + 'images': [], +} diff --git a/web_field_float_compute/static/src/img/icon.png b/web_field_float_compute/static/src/img/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..c0ad599b6986494c79525d0eedddabd87a343a86 GIT binary patch literal 3262 zcma)9X)qh?7EV525&IWvDWzJq)f%;nrKqZ1wW@ZNAc%cw?OLt9)J}<|gb+a}YAIjT zzNe_ImQ>n`wHkZl`tIDBJNMsxXP)z%^Uj=k-*bLEb54S}sR1j~B_;p>z-o9$&+?q3 z{{bWYxg}^i51rGW0k;gT7|%~Qqig(m4D!8W6953P_51^1)(tlP^Gm)!{fB|~eBgm0 z&i*ifj;oIg?24hcvm4A3=Ir{!ZvdtN0I;YV>gia8zS&%SVr6Ar)U~@Ec7MZMTlj^( zw49T+m6flzVoRVM-1t#mOOS@moU0waCD^OUBm|NwCQ1@P{z&dKMW>Lm%U|)C3{Q9| zczdz%=I~yzaMA0Dzawn4i`hDL?&+1}$a3+BLVc(S^XXV>+S*=$-+#<`D9>fPN336NY~Pz*FMLc|@!n*M{O<3#5;P$1#efc5K=6kmSvmlox;lO4%@vUlf7R~Yy*cQ@FvwT^hl#>Vwv@I)7`?>9N*5K!jSVYq7T!=r1Va4(Rrb$t63(D}>6GzCAaU zKwnwZ=2G|3s!%*cHJ2m!FGqWz6H^0N^?2qv`%|t(*K9p^XLt)F)JRjn+UH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