Skip to Content
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
3 Ответы
7042 Представления

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
Аватар
Отменить