i'm searching the records from another model and after getting the record i'm writing that record in lines using one2many relation
here is my code in which i'm writing the the data in one2many line
for file in files:
self.allotment_line_id = [(0, 0, {'member_id': file.membership_id.id,
'file_id': file.id,
'tracking_no': file.tracking_id,
'sector_id': file.sector_id.id,
'category_id': file.category_id.id,
'unit_category_type_id': file.unit_category_type_id.id,
'size_id': file.size_id.id,
'street_id': file.street_id.id,
'preference_ids': [(6, 0, file.preference_ids.mapped('factor_id.id'))]
})]
after this i'm using on change api for triggering the my inventory_id field for applying the domain HERE IS THE CODE FOR DOMAIN
@api.onchange('inventory_id')
def _onchange_inventory(self):
res = {'domain': { 'inventory_id': [('state', '=', 'available_for_sale'),
('category_id', '=', self.category_id.id),
('unit_category_type_id', '=',self.unit_category_type_id.id)]
}
}
now in lines category_id and unit_category_type_id.id have values, and when i click the inventory_id field it will show me complete inventory and then i select one of them after that if i click again on inventory_id field then it trigger the inventory_id and after that it shows me
my required result related to domain
but i want that on first time clicking on inventory_id field it trigger my function