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 overwrite existing field definition?

By
Jakub Krzempek
on 11/5/13, 10:26 AM 1,093 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()

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