Skip to Content
Menu
This question has been flagged
2 Replies
1182 Views
I have a many2one field:
car_name = fields.Many2one('fleet.vehicle', string="Vehicle", help="Vehicle")

I have the cars available now based on the condition on state_id
fleet_available_now = self.env['fleet.vehicle'].search([('state_id', 'in', [1, 2]),
])

I need to assign the 'fleet_available_now' values to 'car_name'
How to achieve this?
Avatar
Discard
Best Answer

fleet_available_now = self.env['fleet.vehicle'].search([('state_id', 'in', [1, 2]),
])

if you want to show more than one value in this (car_name) than made that field many2many

Avatar
Discard
Best Answer

Hello Rejini,

I think this not correct approach, because car_name is many2one field and it can be store only one value.

fleet_available_now = self.env['fleet.vehicle'].search([('state_id', 'in', [1, 2])])  this will 
give more than one result some times.
Avatar
Discard
Related Posts Replies Views Activity
2
Nov 24
272
1
Oct 24
335
4
Oct 24
326
2
Oct 24
362
2
Dec 24
678