콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
13113 화면

Hi! I'm inheriting class and I want to get there language of current logged in user

class hr_employee(osv.osv):

    _name = "hr.employee"
    _inherit = "hr.employee"

    _columns = {
        'code': fields.char('Code', size=11, select=True)
    }

How can I do so?

아바타
취소

hi look in file i18n you can create your translation otherwise : you Have Translation in your Form mode developer

작성자

I think about it, but I dont know all cases of this field.

Log in Developer Mode. a dropdown at the top left, you will add a translation

베스트 답변

Hi from pre-defined method create and write you can get lang of current user after override that method

for example:

 def create(cr,uid,vals,context=None):
     lang=self.pool.get('res.users').browse(cr,uid,uid).lang.id
     vals.update({'lang_field':lang})
     return (hr_employee,super).create(cr,uid,vals,context)

thanks Sandeep

아바타
취소