Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
11547 มุมมอง

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?

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด
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

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ก.ค. 25
2
2
เม.ย. 21
13827
2
ส.ค. 18
4708
0
เม.ย. 16
9224
type error unsupported operand types (s) แก้ไขแล้ว
2
ม.ค. 24
17118