Odoo Help


Show Existing Products of a customer in a tab

on 3/3/16, 3:11 AM 689 views


I'm very new in python and odoo so I need a help.

In project>task module I've added a selection field which for select customer. now I need when I select a customer then his products will show in a tab.

can anyone help me please.

I check it but I don't understand what you need, post some code of what you are doing

Axel Mendoza
on 3/7/16, 4:24 AM
On 3/7/16, 7:38 AM


<record id="view_task_form2_inherited" model="ir.ui.view">

<field name="name">project.task.form.inherited</field>

<field name="model">project.task</field>

<field name="inherit_id" ref="project.view_task_form2"/>

<field name="arch" type="xml">

<field name="reviewer_id" position="after">

<field name="customer" />


<notebook position="inside">

<page string="Products">

<field name="products" />





.py file

from openerp import api, fields, models

class project_task(models.Model):

_inherit = "project.task"

customer = fields.Many2one('res.partner', string="Search Customer Name")

products = fields.One2many('product.template', compute='_get_products', string="Products")

def _get_products(self):

if self.customer:

order_line_list = self.env['sale.order.line'].search([('name.id','=',self.order_partner_id.id)])

if order_line_list:

ol_list = []

for partner in order_line_list:


prod = self.env['product.template'].browse(ol_list)

                self.products = prod

I want: From selection field when a customer will be selected then his bought product will show in a tab below.

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

1 follower(s)


Asked: 3/3/16, 3:11 AM
Seen: 689 times
Last updated: 3/7/16, 7:38 AM