Odoo Help

0

Many to many field

By
Umashankar Subramani
on 1/12/15, 4:33 AM 745 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
1

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.
 

0
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.

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

2 follower(s)

Stats

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