class PurchaseOrder(models.Model):
_inherit = 'purchase.order'
po_type = fields.Selection([
('normal_order', 'Normal Purchase Quation/Order'),
('service_order', 'Service Order')
],default='normal_order',string="Purchase Order Type")
class PurchaseOrderLine(models.Model):
_inherit = 'purchase.order.line'
product_id = fields.Many2one('product.product', string='Product', domain=[('purchase_ok', '=', True)], change_default=True, index='btree_not_null')
In Odoo 17, use the onchange function to modify the domain of the product field so that only 'service' type products are displayed when the po_type is set to 'service_order'
can we achive this without declaring addtional field ??