Odoo Help

0

how to overwrite existing field definition?

By
Jakub Krzempek
on 11/5/13, 10:26 AM 1,223 views

I'm trying to assign multiple related companies (from res.partner with is_company? = True) to a partner who is not a company. To do that I've decided to make my own module that overwrites existing fields making these many2many instead of o2m and m2o. The problem is that nothing changes after installing the module. I've been successful in adding a new field (e.g. 'test' : field.integer("Test", size=11)), but with no avail in adding even a new fields with m2m relationship. Below is my code adding two new fields to res.partner. Ideally I'd like to overwrite parent_id and child_ids. If you could point me mistakes and point me to a right direction, I'll be grateful. PS. The server log is free from errors while installing the module.

from openerp.osv import fields, osv

class legacy_projects(osv.osv):

    _inherit = "res.partner"

    _columns = {
            'parent_ids' : fields.many2many('res.partner', 'res_partner_companies_rel', 'child_id', 'parent_id', "Related Companies"),
            'worker_ids' : fields.many2many('res.partner', 'res_partner_companies_rel', 'parent_id', 'child_id', "Contacts")
    }

legacy_projects()

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: 11/5/13, 10:26 AM
Seen: 1223 times
Last updated: 3/16/15, 8:10 AM