def button_dummy(self): for po in self: currency = po.currency_id.name text_amount = amount_to_text_en.amount_to_text( po.amount_total, 'en', currency) self.write({'amount_to_text': text_amount}) return True
def button_calculate(self): self.button_reset_taxes() for inv in self: currency = inv.currency_id.name text_amount = amount_to_text_en.amount_to_text( inv.amount_total, 'id', currency) self.write({'amount_to_text': 'Say, ' + text_amount}) return True
def amount_to_text(self, nbr, currency): lang='en' if currency.name!='INR': return amount_to_text_en.amount_to_text(nbr, lang, currency.name).upper() if currency.name=='INR': text = Number2Words().convertNumberToWords(nbr).upper() if text and len(text)>3 and text[:3]==' ': text = text[3:] return text
def amount_to_text(self, nbr, lang='vn', currency='USD'): if lang == 'vn': # chuoi = amount_to_text_vn.amount_to_text(nbr, lang) # kt = chuoi[0].upper() # # bt = chuoi[0] # chuoi = chuoi.replace(bt,kt,1) return amount_to_text_vn.amount_to_text(nbr, lang) else: return amount_to_text_en.amount_to_text(nbr, 'en', currency)
def amount_to_text(self, nbr, currency): lang = 'en' if currency.name != 'INR': return amount_to_text_en.amount_to_text(nbr, lang, currency.name).upper() if currency.name == 'INR': text = Number2Words().convertNumberToWords(nbr).upper() if text and len(text) > 3 and text[:3] == ' ': text = text[3:] return text
def amount_to_text(self, lang='vn', currency='USD'): if lang == 'vn': return amount_to_text_vn.amount_to_text(self.sum_debit, lang) else: return amount_to_text_en.amount_to_text(self.sum_debit, 'en', currency)
def amount_to_text(self, nbr, lang='vn', currency='USD'): if lang == 'vn': return amount_to_text_vn.amount_to_text(nbr, lang) else: return amount_to_text_en.amount_to_text(nbr, 'en', currency)