Odoo Help

5

How to get current language in model?

By
Vitaliy
on 5/20/13, 8:39 AM 3,907 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

ClueLogics Technologies Pvt. Ltd.

--ClueLogics Technologies Pvt. Ltd.--
6143
| 6 5 8
Delhi NCR, India
--ClueLogics Technologies Pvt. Ltd.--

 ClueLogics Technologies Pvt Ltd is a Software product and services provider. We are positioned to deliver robust, rapid and reliable Information Technology solutions that work. What we succeed upon is Technology and Technical Expertise. The industry review of ClueLogics has been commendable for the past years as most of its business comes from repeat orders by highly satisfied clients.

ClueLogics Technologies Pvt. Ltd.
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

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

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