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

Show Existing Products of a customer in a tab

By
nahian
on 3/3/16, 3:11 AM 296 views

Hi

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
0
nahian
On 3/7/16, 7:38 AM

xml

<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" />

</field>

<notebook position="inside">

<page string="Products">

<field name="products" />

</page>

</notebook>

</field>

</record>


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

ol_list.append(supp.product_tmpl_id.id)

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.

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

1 follower(s)

Stats

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