Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to add amount to text in customer invoice(account.invoice) form not in sale.order........need a help

By
Odoo
on 7/17/14, 5:47 AM 2,567 views

Hi,

I need to add a field in amount in words account.invoice model .... need a help

class account_invoice(osv.osv):
  _inherit = 'account.invoice'
  _description = "Account invoice"
  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_invoice': '0.0',
                        }
        val = val1 = 0.0
        cur = order.pricelist_id.currency_id  #How to change code  here @@@@@Error from this line
        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_invoice': fields.function(_amount_in_words, string='In Words', type="char", store=True, help="The amount in words"),

             }  
account_invoice()

-------------------.xml-----------

 <record model="ir.ui.view" id='view_account_order_form' >
      <field name="name">account.order.form</field>
      <field name="model">account.invoice</field>
      <field name="inherit_id" ref="account.invoice_form"/>
      <field name="arch" type="xml">
          <field name="amount_total" position="after">
            <field name="amount_words_invoice"/>
          </field>
       </field>
    </record>

Nice answer.

rosey
on 7/18/14, 2:09 AM

ok Libu Koshy. If you got your solution, then accept my answer by clicking the tick mark.

jyothi
on 8/6/14, 6:53 AM
2

Remya

--Remya--
5813
| 7 8 8
Thiruvananthapuram, India
--Remya--

Working as an Senior ODOO developer. http://in.linkedin.com/pub/remya-r/69/a23/298

Remya
On 7/18/14, 1:31 AM
1

Nehal

--Nehal--
2090
| 5 2 8
Ahmadabad, India
--Nehal--
Nehal
On 7/17/14, 6:00 AM

Hi,

following links may help you:
https://www.odoo.com/forum/help-1/question/conversion-of-amount-to-text-in-openerp-43765
https://accounts.openerp.com/forum/help-1/question/detailed-procedure-to-do-the-number-to-text-conversion-10504
 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 7/17/14, 5:47 AM
Seen: 2567 times
Last updated: 3/16/15, 8:10 AM