Hi all,
Here i tried the following,
1.add a dropdown field for product category in sale oder line.
2.in that sale order line list the products respective to selected product category.
Please suggest any ideas
Thanks in advance.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi all,
Here i tried the following,
1.add a dropdown field for product category in sale oder line.
2.in that sale order line list the products respective to selected product category.
Please suggest any ideas
Thanks in advance.
Hi,
you can use this method. you have to do things in the sale order line then you must inherit sale.order.line.
class SaleOrderLineExt(models.Model):I think this will help you, don't forget to add this category field in the UI._inherit = 'sale.order.line' categ_id = fields.Many2one('product.category') @api.onchange('categ_id')
def _onchange_categ(self):
return {'domain': {'product_id': [('categ_id', '=', self.categ_id.id)]}
Make onchange for the product category.
select category then search product ids on the basis of category_id pass the domain of product ids in return result of onchange hope this will help you.
Is this code coorect :
@api.onchange('x_product_categories')
def _show_list_of_products(self):
for order in self:
selected_category_id = order.x_product_categories
product_id = fields.One2many('product.product' , domain=['category_id', '=','selected_category_id'])
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
Mar 15
|
2146 | ||
|
1
Oct 23
|
1369 | ||
|
4
Feb 24
|
11289 | ||
|
4
Dec 22
|
7834 | ||
|
1
May 18
|
2583 |
can you post your code here, whatever you have tried so far.