unFormatCurrency.js 610 B

12345678910111213141516
  1. (function(){
  2. "use strict";
  3. /* ---------------------------------------------------------------------
  4. * [unFormatAmountCurrency]
  5. * Description: Format currency to number.
  6. * Written by Robert Gauto.
  7. * --------------------------------------------------------------------*/
  8. openerp.web.unFormatCurrency = function () {
  9. return function(value) {
  10. value = value.replace(/[\.|,](\d{0,2}$)/, '?$1').split(/\?/)
  11. value[0] = value[0].replace(/[^0-9]/g, '')
  12. value = Number.parseFloat(value.join('.')) || 0
  13. return value
  14. }
  15. }()
  16. })();