amount to text in reports

Asked by Pravitha V

hello all,i want to get the total amount in invoice bill to be displayed in words also...is there any way to get it..i used to edit the rml file to customize the reports....or is there any way to show the amount converted to text value in the interface itself in the invoice form?

please help its very urgent

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Pravitha V
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
David Mitchell (www.novapointgroup.com) (david-novapointgroup.com) said :
#1

If you review the check_writing module in openerp-usa you can see examples
of how to include the text value in a field.
There are also examples in the RML in the reports to show the lines to
display the amt in words.

Alternatively, in 6.1 OpenERP utilized a new library for the amount 2 text
that is found in the tools.py folder on the openerp-server.
Look in the check writing module there if you want to leverage that library
and approach.
The RML should also display the amount in words as well when printing the
check.

Either should provide you the info you need.

Dave

On Fri, Mar 30, 2012 at 5:45 AM, Nightfury <
<email address hidden>> wrote:

> New question #192132 on OpenERP Server:
> https://answers.launchpad.net/openobject-server/+question/192132
>
> hello all,i want to get the total amount in invoice bill to be displayed
> in words also...is there any way to get it..i used to edit the rml file to
> customize the reports....or is there any way to show the amount converted
> to text value in the interface itself in the invoice form?
>
> please help its very urgent
>
> --
> You received this question notification because you are a member of
> OpenERP Committers, which is an answer contact for OpenERP Server.
>

Revision history for this message
Pravitha V (pravithavarghese1) said :
#2

thankyou for your help sir need your help whenever needed

Revision history for this message
Pravitha V (pravithavarghese1) said :
#3

heyy got the output for amount to text in Indian Format in the reports directly...its simple........
for eg: in slae_order.py in sale report folder just add the following lines

Code:

from tools.translate import _
from tools import amount_to_text
from tools.amount_to_text import amount_to_text_in

and

Code:
'time': time,
'amount_to_text_in': amount_to_text_in,

then add the following line to the .rml file

Code:

[[str(amount_to_text_in(o.amount_total,"Rupee"))]]

_________________
Regards,
Nightfury

Revision history for this message
Pravitha V (pravithavarghese1) said :
#4

thankyou my problem solved

Revision history for this message
USHA DEO (usha-deo) said :
#5

Hi

I am unable to do this

i get error for line

from tools.translate import _

Revision history for this message
USHA DEO (usha-deo) said :
#6

do you need to recompile the sale_order.py file ?

how to compile it ?

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#7

Hello Usha,

Once you make the changes in any of the python file you must restart the OpenERP Server.

Can you please give us the Traceback that you get while importing from tools.translate?

Waiting for your response.

Thanks & Regards,
Serpent Consulting Services

Revision history for this message
USHA DEO (usha-deo) said :
#8

Hi Serpent consulting,

I modified sale\report\sale_order.py file as given

I removed the sale\report\sale_order compiled file

I modified the rml file using open office and saved it

re-srated the openerp server, it does not start !

pl. give steps if i am missing !!

as I coped the old report folder, if I restore it back the openerp starts..

- Usha

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#9

Hello Usha,

It seems to be a problem with code. Have you written the code properly in sale_order.py?

Can you please send us the Traceback that you get on server side when you're trying to restart the server?

Regards,
Serpent Consulting Services

Revision history for this message
Gaby Lopez (gabyokal) said :
#10

Hi Serpent consulting,
I have the same error:

2015-01-15 18:19:00,914 22621 ERROR Gaby openerp.tools.safe_eval: Cannot eval 'str(amount_to_text_es_MX(o.amount_total,"Pesos"))'
Traceback (most recent call last):
  File "/opt/openerp/server/openerp/tools/safe_eval.py", line 285, 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_es_MX' is not defined

** In the sale.order.py I have the following code:

import time

from openerp.report import report_sxw
from tools.translate import _
from tools import amount_to_text
from addons.l10n_mx_invoice_amount_to_text import amount_to_text_es_MX

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_es_MX': amount_to_text_es_MX,
        })

I don't know what happen :(

I changed the code in sale_order.py, after add [[str(amount_to_text_es_MX(o.amount_total,"Pesos"))]] to my report and restart the server.

Waiting for your response.

Thanks & Regards,
Gaby