Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I am new in python, I've added a drop-down field so I can select a customer and seen his/her existing products in a tab.
but I cant show the list of existing products of a customer, how can I do it, can anyone help me please.
One option is to create a One2many compute field on res.partner model and call that on a tab in customer form view. So when you open the customer form, under a "Products" tab, you may see the existing products of the customer. You may check the tutorial on how to create a One2many compute or functional field. Or else you may contact me on firstname.lastname@example.org for further help.
For example, you may try by adding the following code:
in your .py file:
_inherit = "project.task"
customer = fields.Many2one('res.partner', string="Search Customer Name")
products = fields.One2many('product.template', compute='_get_products', string="Products")
product_list = self.env['product.supplierinfo'].search([('name.id','=',self.customer.id)])
p_list = 
for supp in product_list:
prod = self.env['product.template'].browse(p_list)
self.products = prod
in your xml file:
<record id="view_task_form2_inherited" model="ir.ui.view">
<field name="inherit_id" ref="project.view_task_form2"/>
<field name="arch" type="xml">
<field name="reviewer_id" position="after">
<field name="customer" />
<field name="products" />
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
|Asked: 2/22/16, 3:28 AM|
|Seen: 564 times|
|Last updated: 3/5/16, 1:37 PM|