How to Add a Domain to a Field Dynamically based on another Field

How to Add a Domain to a Field Dynamically based on another Field

Cybrosys Technologies

2 года назад

545 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Sefa Şenlik
Sefa Şenlik - 15.10.2023 13:52

Unfortunately, it doesn't work in Odoo 16 :/

Ответить
Mohamed sobh
Mohamed sobh - 27.09.2022 02:34

@api.onchange('category_id')
def _onchange_category_id(self):
print('hi....................', self.category_id)
products = []
if self.category_id:
products = self.env['product.product'].search([('categ_id', '=', self.category_id.id)]).ids
print('list....................', products)
return {'domain': {'farm_materials_oline.product_id': [
('id', 'in', products)
]}}

it return in log the result but the field product still read all product?!

Ответить