from odoo import fields, models, api class ProductPublicCategory(models.Model): _inherit = "product.public.category" brand_id = fields.Many2one('brands', string='Brand') product_ids = fields.One2many('product.product', 'product_public_category_id', string='Products') # @api.model # def _onchange_child_frontend_id2(self, parent): # domain = {} # if parent: # parent_records = self.browse(parent) # parent_names = parent_records.mapped('name') # domain['child_frontend_id2'] = [ # ('parent_frontend_id', 'in', parent), # ('parent_frontend_id.name', 'ilike', parent_names) # ] # else: # domain['child_frontend_id2'] = [] # return {'domain': domain}