Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Conversion of amount to text in openerp...

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
3 Răspunsuri
20573 Vizualizări
Imagine profil
Ashmsh.M

in order to convert the amount to text in the sales order

I add the following lines in the sale/report/sale_order.py

from openerp.tools import amount_to_text
from openerp.tools import amount_to_text_en

'amount_to_text_en': amount_to_text_en, In the code

Then in the corresponding rml file i add [[str(amount_to_text(o.amount_total,"Ruppes"))]]

And in report.sxw also added this line. [[str(amount_to_text(o.amount_total,"Ruppes"))]]

But it will not generate any change in the printable report..

By looking on the openerp-server log file below mentioned warning displayed..

openerp.tools.safe_eval: Cannot eval 'str(amount_to_text(o.amount_total,"Ruppes"))'

Traceback (most recent call last): File "/opt/openerp/server/openerp/tools/safe_eval.py", line 241, in safe_eval return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict) File "", line 1, in <module> NameError: name 'amount_to_text' is not defined

How can be make amount to text in openerp v7.0

0
Imagine profil
Abandonează
Imagine profil
Dasadiya Chaitanya
Cel mai bun răspuns

Another Way just need to install the num2word python library and use it in as your  .py file

from num2words import num2words

use it in Qweb report py file

    def __init__(self, cr, uid, name, context):
        super(supplair_invoice, self).__init__(cr, uid, name, context)
        self.localcontext.update({
            'time': time,
            'num2words':num2word,
            'get_contact_chield':self.get_contact_chield,
        })

and use in your view xml file as report file

<span t-esc="str(num2words(o.amount_total)).upper()"  />

 

2
Imagine profil
Abandonează
Imagine profil
Prakash
Cel mai bun răspuns

Add amount_to_text in init method also

For Example in the sale/report/sale_order.py

from openerp.tools import amount_to_text
from openerp.tools import amount_to_text_en

class order(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context=None):
        super(order, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time, 
            'show_discount':self._show_discount,
            'amount_to_text': amount_to_text,
            'amount_to_text_en': amount_to_text_en
        })

Then in the corresponding rml file add

 [[str(amount_to_text(o.amount_total,"Ruppes"))]]

And Restart the server

4
Imagine profil
Abandonează
Ashmsh.M
Autor

ok.. Gives words in report. Through inheritance I make new module by refering the this. http://help.openerp.com/question/10504/detailed-procedure-to-do-the-number-to-text-conversion/ Inheriting the sale order. Write onchange function for amount_total field ,but now updating the values . it appears to zero in total

Prakash

on_change function shows output Rupees in word in the form. To show only in reports the above code updated

Ashmsh.M
Autor

By using your code display in our report.. but in the salesorder form not display the words..

Prakash

To display in the form follows the steps: http://help.openerp.com/question/10504/detailed-procedure-to-do-the-number-to-text-conversion/ 1) make sure to create field data type char or text 2) To define on_change method in xml file amount field 3) Restart the server and update the module 4) result will be generate after change the amount fields

Ashmsh.M
Autor

hello prakash i will post my .py file and xml file. please check. During onchange my amount_total field became "Zero" . Will u please check the code and help me to find the solution..

Imagine profil
Ashmsh.M
Autor Cel mai bun răspuns
from openerp.osv import fields, osv
from tools.translate import _
from openerp.tools import amount_to_text_en
from openerp.tools.amount_to_text_en import amount_to_text 

class sale_order(osv.osv):
  _inherit = 'sale.order'
  _description = "Sales Order"
  def _amount_in_words(self, cr, uid, ids, field_name, arg, context=None):
    cur_obj = self.pool.get('res.currency')
    res = {}
    for order in self.browse(cr, uid, ids, context=context):
        taxed = untaxed = 0.0
        res[order.id] = {
            'amount_words': '0.0',
                        }
        val = val1 = 0.0
        cur = order.pricelist_id.currency_id
        for line in order.order_line:
            val1 += line.price_subtotal
            val += self._amount_line_tax(cr, uid, line, context=context)
        taxed = cur_obj.round(cr, uid, cur, val)
        untaxed = cur_obj.round(cr, uid, cur, val1)
        res[order.id] = amount_to_text_en.amount_to_text(float(taxed + untaxed))
    return res

  _columns = {
              'amount_words': fields.function(_amount_in_words, string='In Words', type="char", store=True, help="The amount in words"),

             }  

sale_order()

In XML file..

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
  <data> 
    <record model="ir.ui.view" id='view_report_order_form' >
      <field name="name">sale.order.form1</field>
      <field name="model">sale.order</field>
      <field name="inherit_id" ref="sale.view_order_form"/>
      <field name="arch" type="xml">
       <!-- <form string="Sales Order" version="7.0"> -->
          <field name="amount_total" position="after">
            <field name="amount_words"/> 
          </field>
        <!-- </form>-->
       </field>
    </record>

<record model="ir.actions.act_window" id="action_orders">
<field name="name">Salereport1</field>
<field name="res_model">sale.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>

</record>

</data> </openerp>

3
Imagine profil
Abandonează
Prakash

In xml file onchange should be amount float change the code <field name="text_amount" on_change="onchange_amount_total(amount_total)"/> into <field name="amount_total" on_change="onchange_amount_total(amount_total)"/

Ashmsh.M
Autor

hi prakash Issue partially solved . See the updated post above.. I commented the line <form string="Invoice" version="7.0"> and its closing tags. Now amount appears in Euro and Cent , is it possible to make it to indian format..

Prakash

Updated the link http://help.openerp.com/question/37135/how-to-convert-amount-to-letters-in-indian-format/

Ashmsh.M
Autor

thanks prakash.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now