Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

5

How to get current language in model?

By
Vitaliy
on 5/20/13, 8:39 AM 2,496 views

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

le_dilem
on 5/20/13, 8:47 AM

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

Vitaliy
on 5/20/13, 8:50 AM

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

le_dilem
on 5/20/13, 8:56 AM
15

Sandeep

--Sandeep--
6083
| 6 5 8
Delhi, India
--Sandeep--
Python OpenERP Developer http://in.linkedin.com/pub/sandeep-rana/3b/a16/786/
Sandeep
On 5/20/13, 8:50 AM

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 5/20/13, 8:39 AM
Seen: 2496 times
Last updated: 3/16/15, 8:10 AM