Odoo Help


Many to many field

Umashankar Subramani
on 1/12/15, 4:33 AM 825 views

Hi ,

     I need to access the relational table created by many to many field, is it possible to access the table?

Thanks in advance......

What is your exact aim? Whenever you call that field you will get the appropriate values, like the other fields.

Emipro Technologies Pvt. Ltd.
on 1/12/15, 4:35 AM

I want that relational id values, i cant able to get it through search method

Umashankar Subramani
on 1/12/15, 4:38 AM

Do you mean the id field of that relational table? Why do you need that? As soon as you will call that many2many field there will be browse record of the field against which you have created the relation.

Emipro Technologies Pvt. Ltd.
on 1/12/15, 4:43 AM

I need it for my module customization, which link the customer and product category

Umashankar Subramani
on 1/12/15, 4:52 AM

Sorry, but I don't think that you need to know the "ID"(actual ID field) field of that relational table. You can have customer and product as many2many, what is the need? Lets say you got the ID, how and where do you use that ID field. If possible post your code here.

Emipro Technologies Pvt. Ltd.
on 1/12/15, 4:54 AM

I am just customizing the sale module , i just link the customer with certain product category, so that in the sale order if i entered the name of the customer , i need only the certain category that i had linked with that pacticular customer, model_inherit.py from openerp import models, fields class res_partner(models.Model): _inherit='res.partner' products=fields.Many2many('product.category','cust_produ_rel','cust_id','prod_id','Products') inherit_view.xml cust_prod_inherit res.partner <xpath expr="//notebook[@colspan=4]" position="attributes"> 5 <xpath expr="//notebook/page[@name='sales_purchases']" position="after">

Umashankar Subramani
on 1/12/15, 5:01 AM

So yes, as soon as you will do "partner_id.products", (products is your field name) it will give you the browse records of only all those categories which are linked to that particular customer. Try this.

Emipro Technologies Pvt. Ltd.
on 1/12/15, 5:06 AM

I cant get it , please

Umashankar Subramani
on 1/12/15, 5:12 AM

Using that sale.order, i am get the product category but i need match between the customer and the product category , so that i can use it

Umashankar Subramani
on 1/12/15, 5:22 AM

That is what I am saying once you will have the browse record of 'sale.order', you can get the product categories of customers as 'br_sale_order.partner_id.products'. Where do you want to match? With what you want to match it? You will only those product categories which are there in that particular customer not more than that.

Emipro Technologies Pvt. Ltd.
on 1/12/15, 5:27 AM

Emipro Technologies Pvt. Ltd.

--Emipro Technologies Pvt. Ltd.--
| 6 7 8
Rajkot, India
--Emipro Technologies Pvt. Ltd.--

Being an emerging leader in IT market since 2011, Emipro Technologies Pvt. Ltd. has been providing a wide range of business solutions in Odoo & Magento. We are pleased to have a large pool of contented customers with our meticulous work in the domain of ERP & e-Commerce. A ray of relief & satisfaction to  our customers heart by our successful deployment in their organization, purely represents our success in Odoo platform. Hence, we take pride for being an Odoo partner with a vision of expanding our strategic alliances with our customers to offer them high value-added, trustworthy & cost effective solutions.


Since establishment, our business has span across 11 countries of the world. Our customers are companies of all sizes ranging from start-ups to large enterprises, who realize that they need a professional business solutions to generate revenue streams, establish proper communication channels or streamline business operations. Standing with strong determination of customer satisfaction, observing each minute detail of their business processes, providing proper guidance and moving forth to develop product accordingly adds our value and reliability among our customers. 


We are blessed with efficient, passionate & eclectic young developers who have come across almost all kinds of business profiles, working with full dedication, applying creativity & new features in existing modules and completing customer's projects successfully on predefined target. Our in-depth knowledge while giving business solutions in Odoo allows us to offer following services to our customers :


  • Consulting
  • Installation, Configuration & Customization
  • Training & Support
  • Maintenance
  • Upgradation
  • Documentation
  • Crafting community modules
  • Drafting videos on demand
  • Smart Apps development

We will be :) to welcome you @ www.emiprotechnologies.com to solve any kind of your business needs around Odoo. However we are just an inch away from you by email info@emiprotechnologies.com or a tweet to @EmiproTech

Emipro Technologies Pvt. Ltd.
On 1/12/15, 5:10 AM

When ever you will browse the sale.order model, you can use like this let's say your browse record is "br_sale_order", than you can use "br_sale_order.partner_id.products", which will give you the browse records of "product.category" model and you can iterate the loop on it.

Umashankar Subramani
On 1/12/15, 5:03 AM

I need some clarification regarding this relational table. Y cant i able to access the table...........

Thanks in advance

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.


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

2 follower(s)


Asked: 1/12/15, 4:33 AM
Seen: 825 times
Last updated: 3/16/15, 8:10 AM