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

Hello,

I'm triying to create a new column of type integer but when I try to use it from the UI, I can't set a big value like: 7904001151362.

I need to store integer values with a size up to 15.

Is there a way to set this on models avoiding the use of fields.Char?

Thank you!

Best regards

อวตาร
ละทิ้ง

@alejandro can you explain you exact purpose behind using this length of integer?

คำตอบที่ดีที่สุด

Hello Alejandro, fields.integer are stored as PostgreSQL 'int4' (integer) which are limited in size by the database.

How about using fields.float instead, using size to limit the number of digits, and limiting the scale to 0?

'big_number': fields.float('Big Number', size=15, digits=(15, 0)),  # OpenERP v7.0

...

big_number = fields.Float(string='Big Number', size=15, digits=(15, 0))  # Odoo v8.0

อวตาร
ละทิ้ง
ผู้เขียน

Thank you Marvin, that worked for me.