Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Conversion of amount to text in openerp...

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
3 Respuestas
20567 Vistas
Avatar
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
Avatar
Descartar
Avatar
Dasadiya Chaitanya
Mejor respuesta

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
Avatar
Descartar
Avatar
Prakash
Mejor respuesta

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
Avatar
Descartar
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..

Avatar
Ashmsh.M
Autor Mejor respuesta
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
Avatar
Descartar
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.

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

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