Odoo Help


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.


Can I add a field to many2many relation table

on 9/4/13, 7:40 AM 2,930 views

Can I add a field to many2many relation table


Grover Menacho

--Grover Menacho--
| 5 7 8
La Paz, Bolivia
--Grover Menacho--

Systems Engineer + MBA

Grover Menacho
On 9/5/13, 12:49 AM

Yes, you have to do this:

class res_partner(osv.osv)
    'category_ids': fields.many2many('res.partner.category','res_partner_category_rel','partner_id','category_id','Categories'),

class partner_category_rel(osv.osv):
    _name = "res.partner.category.rel"
    _rec_name = "partner_id"
    _columns = {
        'partner_id': fields.many2one('res.partner', 'Partner', ondelete='cascade'),
        'category_id': fields.many2one('res.partner.category', 'Category', ondelete='cascade'),
        'additional_field': fields.integer('Other field'),

raul paz
On 4/24/14, 2:52 PM

But, this, only work if the relational class was defined before many2many fields!

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)


Asked: 9/4/13, 7:40 AM
Seen: 2930 times
Last updated: 3/16/15, 8:10 AM