here this code when i select product group its show group wise product in filed. but i want to show product group wise without selecting the product group. that means i want to show specific product group product without selection group please help me
class StockRequisition(models.Model):
_inherit = 'account.move.line'
# product_group = fields.Many2one('product.group', string='Product Group')
# parent_id = fields.Many2one('product.group', string="Product Group")
@api.onchange('product_group')
def onchange_product_group(self):
for rec in self:
return {'domain': {'product_id': [('product_group', '=', rec.product_group.id)]}}
product_group = fields.Many2one('product.group', string='Product Group')
product_id = fields.Many2one('product.product', ondelete='restrict',
string='Consultation Service', help="Consultation Services",
domain=[('hospital_product_type', '=', "consultation")], required=True,
)