def amount_to_text_en(number, currency): number = '%.2f' % number units_name = currency list = str(number).split('.') start_word = english_number(int(list[0])) end_word = english_number(int(list[1])) cents_number = int(list[1]) cents_name = (cents_number > 1) and 'Cents' or 'Cent' return ' '.join(filter(None, [start_word, units_name, (start_word or units_name) and (end_word or cents_name) and 'and', end_word, cents_name]))
def amount_word(self, cr, uid, curr_obj, amount, context=None): words = '' amount = '%.2f' % amount if curr_obj: if curr_obj.name.upper() == 'BRL': currency_name = 'reais' else: currency_name = curr_obj.name list = str(amount).split('.') start_word = english_number(int(list[0])) end_word = english_number(int(list[1])) cents_number = int(list[1]) cents_name = (cents_number > 1) and 'Cents' or 'Cent' if curr_obj.sec_curr_name: cents_name = curr_obj.sec_curr_name if cents_number > 0.00: words = ' '.join( [currency_name, start_word, 'AND', cents_name, end_word]) else: words = ' '.join([currency_name, start_word]) words = words.replace(",", "") words = words.replace("AED", "DIRHAMS") return words + " Only"
def amount_to_text(number, currency): number = '%.2f' % number list = str(number).split('.') start_word = amount_to_text_en.english_number(int(list[0])) end_word = "%d/%d"%(int(list[1]),100) return ' '.join(filter(None, [start_word, 'and', end_word]))
def amount_in_word(self, amount_total): number = '%.2f' % amount_total units_name = 'SR' list = str(number).split('.') start_word = english_number(int(list[0])) return ' '.join(filter(None, [start_word, units_name]))