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

TypeError: a float is required

By
Hans Wiriya
on 6/9/16, 12:17 AM 395 views

I have 2 identical ERP servers running, one is production and the other one is for development purpose. I have an issue about customer invoice (mako file), when i try to print it out i got this error message :

<% hargajual = math.floor(amount_base)%>TypeError: a float is required

But at the production server, there is no error at all when printing. The mako coding file are 100% identical because i copied it from production to development server. 

I think this is not about mako file (both again identical), but must be something else. Any idea what could cause this error?

0
Hans Wiriya
On 6/9/16, 5:18 AM

its the same. somehow the system treats base_amount as string not float. but again the same function/form works on my other duplicate system.


here is the error after adding random:

<% hargajual = math.floor(float(amount_base))%>TypeError: float() argument must be a string or a number

0
kirubanidhi
On 6/9/16, 1:55 AM
import random, math 
def fun():

           hargajual = math.floor(amount_base)

            return hargajual


please specify header file named as

import math

then create a fun as sample example

def fun(self):

x=float(amount_base)

y=math.floor(x)

return y

or

return math.floor(float(amount_base))

this code is working check it now

kirubanidhi
on 6/9/16, 2:04 AM

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

1 follower(s)

Stats

Asked: 6/9/16, 12:17 AM
Seen: 395 times
Last updated: 6/9/16, 5:18 AM