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

Hi friendz,

I need to show a field 'db_name' using function field.

def db_name_get(......)
.
.
.

provide me the process or how to get value of database name.

Thanks & Regards,

Atchuthan

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด
def db_name_get( self, cr, uid, ids, field_name, arg, context ):
    return_value = {}

    for record in self.browse( cr, uid, ids, context ):
        return_value[ record.id ] = cr.dbname

    return return_value

Add the function name to the declaration of your functional field.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Another solution:

from openerp.http import request
def db_name_get(......)
dbname = request.session['db']
return dbname
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด
def get_dbname():
    dbname = self.pool.db.dbname
    return dbname
อวตาร
ละทิ้ง