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.

0

how to extend many2many relation table? [Closed]

By
Bole
on 5/25/13, 2:43 PM 1,159 views

The Question has been closed for reason: not relevant or out dated

by
Bole
on 06/27/2014 16:06:38

Im tryin to exdend many2many relation table in a way to add some extra info on all relations...

for example, i would like to add a list of languages, and relate employees to spoken languages, (no prob, many2many work ok) but i would like to write additional info on every relation (like speak, read, write)

i added new class:

class hr_language (osv.Model):
    _name = 'hr.language'
    _description = 'Languages - employee related'

    _columns = {
            'name':fields.char('Language name', size=64),
            'employee_ids':fields.many2many('hr.employee', 'hr_language_employee_rel', 'hr_language_language_id, 'hr_employee_language_id', 'Employees speaking this lang')
               }

inherited employee class:

class hr_employee(osv.osv):
   _inherit = "hr.employee"
   _columns = {
            'language_ids':fields.many2many('hr.language','hr_language_employee_rel','hr_employee_language_id','hr_languages_employee_id,'Spoken languages'}

Now this works well, osv created new relation table 'hr_langugae_employee_rel' fith fields : 'employee_id', 'language_id' , now i need to extend this relation with new attribute data, like read, write, speak... so i can make selections based on specific grade of relations..

For now I created new class containing all this data (language_id, employee_id, speak, read, write) and added new one2many fields to hr.employee and hr.langugae with their symertical many2one in class 'language_competence' but this leaves me with 2 relation fields in main classes (employee and language)

Is there easier or more proficient way to deal with attributes of many2many relation?

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/25/13, 2:43 PM
Seen: 1159 times
Last updated: 3/16/15, 8:10 AM