2
# -*- encoding: utf-8 -*-
3
###########################################################################
4
# Module Writen to OpenERP, Open Source Management Solution
5
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
7
###############Credits######################################################
8
# Coded by: Vauxoo C.A.
9
# Planified by: Nhomar Hernandez
10
# Audited by: Vauxoo C.A.
11
#############################################################################
12
# This program is free software: you can redistribute it and/or modify
13
# it under the terms of the GNU Affero General Public License as published by
14
# the Free Software Foundation, either version 3 of the License, or
15
# (at your option) any later version.
17
# This program is distributed in the hope that it will be useful,
18
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
# GNU Affero General Public License for more details.
22
# You should have received a copy of the GNU Affero General Public License
23
# along with this program. If not, see <http://www.gnu.org/licenses/>.
24
################################################################################
72
def Numero_a_Texto(number_in):
76
if type(number_in) != 'str':
77
number = str(number_in)
84
number_int, number_dec = number_str.split(".")
86
number_int = number_str
89
number_str = number_int.zfill(9)
90
millones = number_str[:3]
91
miles = number_str[3:6]
92
cientos = number_str[6:]
95
if(millones == '001'):
96
converted += 'UN MILLON '
97
elif(int(millones) > 0):
98
converted += '%sMILLONES ' % __convertNumber(millones)
103
elif(int(miles) > 0):
104
converted += '%sMIL ' % __convertNumber(miles)
106
if(cientos == '001'):
108
elif(int(cientos) > 0):
109
converted += '%s ' % __convertNumber(cientos)
113
# if (len(number_dec) < 2 ):
116
converted += number_dec
120
def __convertNumber(n):
126
output = CENTENAS[int(n[0])-1]
130
output += UNIDADES[k]
132
if((k > 30) & (n[2] != '0')):
133
output += '%sY %s' % (DECENAS[int(n[1])-2], UNIDADES[int(n[2])])
135
output += '%s%s' % (DECENAS[int(n[1])-2], UNIDADES[int(n[2])])
139
print Numero_a_Texto(9121234.2)