blob: b706bc126008a3073450ccdb0c70b430c772ff90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
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}
|