Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

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

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

How to Add Amount in Words / Text to Printed Invoice?

Subscribe

Get notified when there's activity on this post

This question has been flagged
pdfinvoicereportprints
7 Replies
33596 Views
Avatar
Budi Hartono

 I am a beginner in programming both python and Odoo. I need a amount to text function that will display amount total in text in the printed invoice. I tried to follow this QWeb report tutorial: https://www.youtube.com/watch?v=tCAUm3MWYzk

Somehow I could create a module that modify the printed pdf. But I really don't have idea on how to put amount in text in the invoice PDF. I have searched the Odoo forum, only to find these guidances that failed to make me understand since I'm a noob:

https://www.odoo.com/forum/help-1/question/detailed-procedure-to-do-the-number-to-text-conversion-10504

https://www.odoo.com/forum/help-1/question/conversion-of-amount-to-text-in-openerp-43765

Here is the file content that modify the original report_invoice.xml. How to call the amount_to_text function in this report_invoice.xml below with the amount_to_text function that already exists in odoo/openerp/tools/amount_to_text.py?

addons/amount_text/views/report_invoice.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <template id="report_invoice_document_inherit" inherit_id="account.report_invoice_document">
            <xpath expr="//div[@class='page']/div[@class='row mt32 mb32']" position="replace">

<div class="row mt32 mb32">32 mb32']" position="replace">
                <div class="row mt32 mb32">
                  <div class="col-xs-2" t-if="o.name">
                      <strong>Keterangan:</strong>
                      <p t-field="o.name"/>
                  </div>
                  <div class="col-xs-2" t-if="o.date_invoice">
                      <strong>Tanggal Invoice:</strong>
                      <p t-field="o.date_invoice"/>
                  </div>
                  <div class="col-xs-2" t-if="o.origin">
                      <strong>Asal:</strong>
                      <p t-field="o.origin"/>
                  </div>
                  <div class="col-xs-2" t-if="o.partner_id.ref">
                      <strong>Kode Customer:</strong>
                      <p t-field="o.partner_id.ref"/>
                  </div>
                  <div class="col-xs-2" t-if="o.reference">
                      <strong>Referensi:</strong>
                      <p t-field="o.reference"/>
                  </div>
              </div>
            </xpath>
            <xpath expr="//table[@class='table table-condensed']" position="after">
            <p>
                <strong>Amount in Text:</strong>                
                <!-- <span t-esc="openerp.tools.amount_to_text(o.amount_total, 'usd')"/> -->
            </p>
            </xpath>
        </template>
    </data>
</openerp>

3
Avatar
Discard
Herry prasetyo

  Pravitha thank you very much 

Susana Castillo

Thanks for sharing. 

Avatar
Zbik
Best Answer

You inherit class account_invoice() like this:

class account_invoice(models.Model):
    _inherit = "account.invoice"
   @api.multi
   def amount_to_text(self, amount, currency='Euro'):
       return amount_to_text(amount, currency)

call in xml

<span t-esc="o.amount_to_text(o.amount_total, 'Euro')"/> 


5
Avatar
Discard
Avatar
Pravitha
Best Answer

 https://github.com/Pravithavarghese1/purchase_amount_to_text

inherit account_invoice():

from odoo.tools import amount_to_text_en

class AccountInvoice(models.Model):
_inherit = "account.invoice"
_description = "Invoice"

    @api.multi
def amount_to_text(self, amount, currency):
    convert_amount_in_words = amount_to_text_en.amount_to_text(amount, lang='en', currency='')
        convert_amount_in_words = convert_amount_in_words.replace(' and Zero Cent', ' Only ')  
        return convert_amount_in_words


In xml:

<span t-esc="o.amount_to_text(o.amount_total, o.currency_id)"/>
2
Avatar
Discard
Avatar
Arafat Ali
Best Answer

For Odoo 10, you can get this free here: https://www.maxibi.com/prints-amount-text-english-using-odoo-free-module/

0
Avatar
Discard
Wimpy

website maintenance, can you provide new link?

Avatar
bunny
Best Answer
<span t-esc="o.amount_to_text(o.amount_total, 'INR')"/> 
0
Avatar
Discard
Avatar
B.hind
Best Answer

hi ,

when i try this code , it isn't working , i have this error

i dont  know how to solve it

File "/opt/odoo/addons/recu_facture/facture.py", line 23, in amount_to_text
    return amount_to_text(amount,currency)
QWebException: ""global name 'amount_to_text' is not defined" while evaluating
"o.amount_to_text(o.amount_total,'Euro')"" while evaluating
"translate_doc(doc_id, doc_model, 'partner_id.lang','recu_facture.recufacture_document')"
0
Avatar
Discard
Pravitha

import amount_to_text from tools.

"from odoo.tools import amount_to_text"

Avatar
le_dilem
Best Answer

Hi,

https://github.com/ledilem/Odoo

0
Avatar
Discard
Budi Hartono
Author

Thanks, I'll take a look

Avatar
Budi Hartono
Author Best Answer

Hi zbik,

Thanks a lot for your reply.

I did what you told, and I got this error.

QWebException: ""'account.invoice' object has no attribute 'amount_to_text'" while evaluating
"o.amount_to_text(o.amount_total, 'Euro')"" while evaluating
"translate_doc(doc_id, doc_model, 'partner_id.lang', 'account.report_invoice_document')"

FYI, these are the files in my modules:

amount_text folder:

views\report_invoice.xml
__init__.py
__openerp__.py
account_invoice.py
In the account_invoice.py

from openerp.tools import amount_to_text
class account_invoice(models.Model):
    _inherit = "account.invoice"
   @api.multi
   def amount_to_text(self, amount, currency='Euro'):
       return amount_to_text(amount, currency)

__init__.py

import account_invoice

__openerp__.py

{
   "name": "Amount Text",
    "version": "1.0.0",
    "depends": ["base"],
    "author": "Budi Hartono",
    "category": "",
    "description": """
    Amount to text.
    """,
    "website": "http://www.recoremedia.com",
    "depends": ["base"],
    "data": ["views/report_invoice.xml"],
    "installable": True,
    "active": False,
    #    "certificate": "",
}

views\report_invoice.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <template id="report_invoice_document_inherit" inherit_id="account.report_invoice_document">
            <xpath expr="//div[@class='page']/div[@class='row mt32 mb32']" position="replace">
                <div class="row mt32 mb32">
                  <div class="col-xs-2" t-if="o.name">
                      <strong>Keterangan:</strong>
                      <p t-field="o.name"/>
                  </div>
                  <div class="col-xs-2" t-if="o.date_invoice">
                      <strong>Tanggal Invoice:</strong>
                      <p t-field="o.date_invoice"/>
                  </div>
                  <div class="col-xs-2" t-if="o.origin">
                      <strong>Asal:</strong>
                      <p t-field="o.origin"/>
                  </div>
                  <div class="col-xs-2" t-if="o.partner_id.ref">
                      <strong>Kode Customer:</strong>
                      <p t-field="o.partner_id.ref"/>
                  </div>
                  <div class="col-xs-2" t-if="o.reference">
                      <strong>Referensi:</strong>
                      <p t-field="o.reference"/>
                  </div>
              </div>
            </xpath>
            <xpath expr="//table[@class='table table-condensed']" position="after">
            <p>
                <strong>Amount in Text:</strong>                
                <span t-esc="o.amount_to_text(o.amount_total, 'Euro')"/> 
            </p>
            </xpath>
        </template>
    </data>
</openerp>

0
Avatar
Discard
Zbik

Try it: "depends": ["account", "report"]

Zbik

... in __openerp__.py and ... update your module.

Budi Hartono
Author

Hi zbik, Thanks, now it's working. You saved my live :) Anyway, I still have to add some import directives in the account_invoice.py to avoid further error messages: from openerp import api from openerp import models, fields

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

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

Sign up
Related Posts Replies Views Activity
Invoice on basic layout
pdf invoice qweb report
Avatar
0
Apr 24
2565
Can not print/preview account report (invoice) Solved
pdf invoice report v14
Avatar
1
Mar 22
4293
Invoice PDF preview Issue
accounting pdf invoice report Odoo17
Avatar
Avatar
1
Oct 25
2539
PDF Invoice line overflow
pdf invoice
Avatar
Avatar
Avatar
2
Jul 25
1527
Quote PDF Spacing & Layout
pdf invoice
Avatar
Avatar
1
Aug 25
2074
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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