i'am added a car field in product template which related to the car model that contains all cars, also i'am work in multi compny, and i'am also added a many2many relation with car model,
all i need is to filter the cars in product template and display all cars that i have been assign in the company
this my code
class cars(models.Model):
_name = 'cars'
name = fields.Char( string="Car",translate=True , required=True, ondelete='restrict')
class autopartscompany(models.Model):
_inherit = 'res.company'
car_ids = fields.Many2many(comodel_name="cars",string="Cars" )
class autopart(models.Model):
_inherit = 'product.template'
car = fields.Many2one(comodel_name="cars", store=True, string="Car", ondelete='restrict', required=False, domain="[('name','=', self.company_id.car_ids )]")
can any one help me how to define the domain filter correctly because that one give me error Error: NameError: name 'self' is not defined