Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
13049 Prikazi

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?

Avatar
Opusti

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

Avtor

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

Best Answer

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

Avatar
Opusti