Commit Graph

85 Commits

Author SHA1 Message Date
Nicolas Martinelli ea2c80cad0 [FIX] web: Python-like rounding method
Javascript and Python handle the rounding of -x.5 differently.

In JS, `Math.round(-0.5)` is equal to `-0`.
In Python, `round(-0.5)` is equal to `-1`.

This will lead to inconsistencies between Python and Javascript, but it
can also lead to inconsistencies in the Javascript itself. Indeed, in
the POS, a refund to the client is entered as a negative number. For
example, `4.245` will be rounded to `4.25`, but a refund of `-4.245`
will be rounded to `-4.24`. The payment and the refund are not
consistent.

Sources:
- http://www.ecma-international.org/ecma-262/6.0/index.html#sec-math.round
- https://docs.python.org/2/library/functions.html#round
- https://en.wikipedia.org/wiki/Rounding#Round_half_up

Fixes #9249
opw-653034
2015-11-04 13:14:59 +01:00
Christophe Simonis 2492503dcc [MERGE] forward port of branch saas-3 up to 50665b4 2015-04-16 19:25:53 +02:00
Christophe Simonis 50665b499a [MERGE] forward port of branch 7.0 up to d0ef1b9 2015-04-16 19:13:56 +02:00
dhr-odoo d0ef1b938d [FIX] Fixed wrong digits format issue for float fields when thousand separator is '.'
The function was returning the number value directly before proceeding to any formatting.
2015-04-16 15:30:20 +02:00
Denis Ledoux 769c62ef27 [MERGE] forward port of branch saas-3 up to f92b2f8 2015-02-06 14:19:30 +01:00
Denis Ledoux f92b2f8d4d [MERGE] forward port of branch 7.0 up to 0b7db55 2015-02-06 14:02:43 +01:00
Denis Ledoux 2a162d9be7 [FIX] web: widget date handling user timezone
When converting a datetime field to date, using the widget date,
the date time value was just cropped, removing the hours,
therefore ignoring the user time zone.

For instance, if the user was in UTC + 1, for a date time 02/02/2015 00:30:00,
applying the widget date on this datetime had as result 02/01/2015,
due to the fact the UTC value of the datetime field was 02/01/2015 23:30:00

fixes #4420
opw-621281
2015-02-04 14:33:01 +01:00
Denis Ledoux d17f22cde7 [FIX] web: float compare, float is zero
When setting a float field,
the web client rounds the value entered by the user
using the instance.web.round_decimals method.
Nevertheless, this is possible that this method returns unrounded float,
due to the float precision
For example, round_decimals(53.8, 2) returns 53.800000000000004

In order to compare this new float value to the old float value
and check the eventual change),
we need to check if the delta between the two is almost 0.
This is the goal of the float_is_zero method introduced during this rev.
which is comparable to the float_is_zero method
already available in the openerp server, in openerp.tools.

Float values compared using the simple === operator
instead of this float_is_zero method
will be regarded as different in some cases,
according to the float value and the precision
And the value of the field will be regarded as changed,
which can lead to unwanted triggers of onchanges.

opw-626635
2015-01-28 15:09:10 +01:00
Denis Ledoux 1684206122 [MERGE] forward port of branch saas-3 up to 0b1b820 2014-12-24 14:04:18 +01:00
Denis Ledoux 0b1b820677 [MERGE] forward port of branch 7.0 up to 6372313 2014-12-24 14:02:17 +01:00
Denis Ledoux 6372313494 [FIX] web: datetime value parsing without time
If the date format language was changed to invert month & day values (so, changed to the classic european format instead of the american format)
Then, when entering manually a datetime without the time (so just '01/02/2014' instead of '01/02/2014 00:00:00', the day and month were inverted (the datetime was set to 02/01/2014 instead of 01/02/2014) because the datetime entered did not exactly match the date + time pattern.

We therefore added a fallback case, to test to parse the value with the date pattern alone (without the time)
2014-12-24 11:37:55 +01:00
Frederic van der Essen a2313b6311 [FIX] point_of_sale: correctly handle the rounding when the unit's rounding is set to zero 2014-11-11 16:18:27 +01:00
Denis Ledoux e1e0cfbba8 [MERGE] Forward-port of 7.0 bugfixes up to e2201369a3 2014-06-24 13:56:51 +02:00
Denis Ledoux e2201369a3 [FIX] web: format.js, toString while parsing date
When attempting to parse client date, value is not always a string.
We force the toString when adding the leading 0, as the replace method is for string
2014-06-24 13:53:02 +02:00
Christophe Simonis bf53aeda94 [MERGE] forward port of branch 7.0 up to e5533d0 2014-06-19 15:32:32 +02:00
Denis Ledoux 86b80cf95e [FIX] web: allow using dates and datetimes without leading zeros 2014-06-18 11:12:27 +02:00
Denis Ledoux 3c0292645f [MERGE] Forward-port of 7.0 bugfixes up to 63ea0df73f 2014-06-16 17:37:10 +02:00
Martin Trigaux 0b4921e4d6 parse_value: interger != float
Wwhen parsing a integer field, do not accept float values. '1' or '1.0' is ok but not '1.1'. (opw 608544)
2014-06-12 13:48:41 +02:00
Denis Ledoux c7b4f44b22 [FIX] web: fix handling of manyone with selection widget
Following the remove of widget selection handling in ir_ui_view of revision 4854.4.298 revid:al@openerp.com-20140121112759-zavwqdyv8kdq4oys

bzr revid: dle@openerp.com-20140218162125-bwse328ybq9d6c2v
2014-02-18 17:21:25 +01:00
Christophe Simonis acb010a985 [MERGE] forward port of branch 7.0 up to revid 4162 launchpad_translations_on_behalf_of_openerp-20140318062141-rdiqz2ptnz3qmxd0
bzr revid: chs@openerp.com-20140129095637-mbfz82r5pyz4dctc
bzr revid: dle@openerp.com-20140210140818-5mtk1qhheo219bm1
bzr revid: dle@openerp.com-20140214114445-krexrwm9o2nrxepk
bzr revid: mat@openerp.com-20140219111353-cxo860z7ctz7om30
bzr revid: dle@openerp.com-20140221120519-1pj3wc8kqgkr5uda
bzr revid: chs@openerp.com-20140318112743-tqv492026y2pnbff
2014-03-18 12:27:43 +01:00
Martin Trigaux 3c3ab07e2f [FIX] format_value: correctly compose if block, we are doing python here...
bzr revid: mat@openerp.com-20140121142625-fy8zkafcvb9wwz88
2014-01-21 15:26:25 +01:00
Martin Trigaux 36048a8442 [IMP] always apply substring and call directly str_to_date
bzr revid: mat@openerp.com-20140121135058-cr3ivak97rqm6npo
2014-01-21 11:50:58 -02:00
Martin Trigaux 9a0a02060f [FIX] format_value: when formating to date, make sure not converting from a datetime string as would make timezones apply and lead to a possible day change
bzr revid: mat@openerp.com-20140121132725-k9f8hna3lg7nq7g8
2014-01-21 11:27:25 -02:00
Martin Trigaux 2dc722ac80 [FIX] format_value: consider text fields te same way as char fields for empty values
bzr revid: mat@openerp.com-20140117113141-i95ncy04azzmahqk
2014-01-17 19:31:41 +08:00
Denis Ledoux 5649e0bbf2 [MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 9770 revid:chs@openerp.com-20140116154645-sy4zhdgqc48xaqbx
bzr revid: dle@openerp.com-20131224112612-5gjit5uu1aaaqstx
bzr revid: dle@openerp.com-20140103094532-mbczi9ssr3gc90o1
bzr revid: dle@openerp.com-20140108105833-gblxqdw3if1gt35k
bzr revid: dle@openerp.com-20140115121441-bskbyxxbc09ubavh
bzr revid: dle@openerp.com-20140115165506-yuux9km39gbv7k4n
bzr revid: dle@openerp.com-20140116161415-0y9m0kgavcytzj9z
2014-01-16 17:14:15 +01:00
Martin Trigaux cc553cc507 [FIX] format: trying to format an undefined value as the same effect as a value to false or infinity: return value_if_empty parameter
bzr revid: mat@openerp.com-20140113172347-00anf6lh2jxin84w
2014-01-13 18:23:47 +01:00
niv-openerp baef37aec6 [IMP] Removed old JavaScript module loading system in the 'web' addons. Still has some retro-compatibility for other addons.
bzr revid: nicolas.vanhoren@openerp.com-20130806125022-bzjbtn0nqk40ak4g
2013-08-06 14:50:22 +02:00
niv-openerp c767a0d34c Added semicolons
bzr revid: nicolas.vanhoren@openerp.com-20130725103301-65nld10p1if7k0zt
2013-07-25 12:33:01 +02:00
niv-openerp 42e493e73e Added Gruntfile with jshint and corrected most js errors
bzr revid: nicolas.vanhoren@openerp.com-20130725100749-0i82gf3k3nvt4r44
2013-07-25 12:07:49 +02:00
Frédéric van der Essen a5e4d757a1 [FIX] add a correct rounding algorithm to be able to duplicate server-side financial computations
lp bug: https://launchpad.net/bugs/1157761 fixed

bzr revid: fva@openerp.com-20130409144414-nqnmkny5cxrmyru1
2013-04-09 16:44:14 +02:00
Anand Patel (OpenERP) 7ae392d316 [FIX][7.0]Fixed float_time widget show wrong format of time.
bzr revid: pan@tinyerp.com-20130122060420-7cho7hewmj80mb16
2013-01-22 11:34:20 +05:30
tsabi 92e87f7e6f Mark strings to be translated.
Maybe some missed, but most of them marked.

bzr revid: tsabi-20121129002200-20tppzvh0ap5tfwe
2012-11-29 01:22:00 +01:00
Fabien Meghazi cd4c3c61ff [FIX] Listview does not handle base64 value for binary fields
lp bug: https://launchpad.net/bugs/1077858 fixed

bzr revid: fme@openerp.com-20121112171128-a1aoq2q4fma6fpxc
2012-11-12 18:11:28 +01:00
niv-openerp a2399bc651 [FIX] Small problem with formatting
bzr revid: nicolas.vanhoren@openerp.com-20121015135607-j2c3dedpxaiuivd3
2012-10-15 15:56:07 +02:00
niv-openerp 87ea306997 [IMP] Modified formatting of m2o to be consistent with the m2o in form view
bzr revid: nicolas.vanhoren@openerp.com-20121015125123-cyosgswtdxgtcom7
2012-10-15 14:51:23 +02:00
Xavier Morel 6f16fc3df9 [FIX] resolve m2m content to record names in list view
bzr revid: xmo@openerp.com-20120928113524-1jw0uj3nccupcjjq
2012-09-28 13:35:24 +02:00
Xavier Morel 5c225be25e [FIX] split formatting of list cells to formatting objects
simpler to override in order to have new list field widgets

bzr revid: xmo@openerp.com-20120808103404-jj6w04x2mp2lrwl1
2012-08-08 12:34:04 +02:00
Xavier Morel f92a925ec8 [CHG] resequence on arbitrary field with @widget=handle
bzr revid: xmo@openerp.com-20120807134343-ch16bcp5s7goqxsl
2012-08-07 15:43:43 +02:00
Fabien Meghazi ce7fb5bb37 [CHG] Ashes to ashes, dashes to underscores.
bzr revid: fme@openerp.com-20120627141249-o10e2htxqtio72l7
2012-06-27 16:12:49 +02:00
niv-openerp cae22c8ff4 [FIX] Problem with float formatting, not analyzing correctly the digits parameter
bzr revid: nicolas.vanhoren@openerp.com-20120621124123-novg5wadwvvcbrkt
2012-06-21 14:41:23 +02:00
Xavier Morel 7c8ed0a00c [IMP] formatting of o2m and m2m fields in list views, courtesy of William Beltrán
bzr revid: xmo@openerp.com-20120607101329-aq0caswlxamd8z0n
2012-06-07 12:13:29 +02:00
Vidhin Mehta (OpenERP) 24f870f066 [FIX]tree view not repecting precision in xml.
lp bug: https://launchpad.net/bugs/994589 fixed

bzr revid: vme@tinyerp.com-20120524071327-zb7i8qiccw6ith8y
2012-05-24 12:43:27 +05:30
William Beltrán 9e5290e997 Changed the way of show the result in case of many2many and one2many fields according to xmo@openerp.com tips.
bzr revid: wbeltran@infostudio.com.ec-20120515132406-950ekkzyi3nq7jmp
2012-05-15 08:24:06 -05:00
Xavier Morel f3721bb43b [FIX] bloody retarded shit from revid:nicolas.vanhoren@openerp.com-20120418145003-vk8kkfgyp0y94hzm
bzr revid: xmo@openerp.com-20120511113222-o4vj35vscnbebvh8
2012-05-11 13:32:22 +02:00
William Beltrán 1e041011fd Changes accordig to quality code.
bzr revid: wbeltran@infostudio.com.ec-20120504193027-0u94nwfbbitoa2zc
2012-05-04 14:30:27 -05:00
William Beltrán f994797896 [FIX]: Bug #942894 This fix the format.js file to make openerp show a count of ids instead the list of them in 2om relationship.
lp bug: https://launchpad.net/bugs/942894 fixed

bzr revid: wbeltran@infostudio.com.ec-20120504172303-r4pynkj4vofeptk5
2012-05-04 12:23:03 -05:00
niv-openerp 09b2ab7583 [fix] problem with format and parse
bzr revid: nicolas.vanhoren@openerp.com-20120418145003-vk8kkfgyp0y94hzm
2012-04-18 16:50:03 +02:00
niv-openerp 753fac33ce [imp] refactored formats.js
bzr revid: nicolas.vanhoren@openerp.com-20120417115916-k57s4rh3wmbajzyz
2012-04-17 13:59:16 +02:00
Xavier Morel 2c4898dc84 [FIX] render statusbar as selection in listview
bzr revid: xmo@openerp.com-20120309143640-784m7dhyeg6cnrfm
2012-03-09 15:36:40 +01:00
msh-openerp 0df6b1bad7 [FIX]Fixed the issue of statusbar which shows technical name in listview if one gives widget=statusbar in listview field.
bzr revid: msh@tinyerp.com-20120307101935-mw4vyjjra6e9uy1v
2012-03-07 15:49:35 +05:30