searchRead method

Future<List> searchRead()

Get records from remote. Must set remoteRecordsCount Read operation is issued without call queue as it is idempotent. Many repositories can call own searchRead concurrently.

Implementation

Future<List<dynamic>> searchRead() async {
  try {
    final Map<String, dynamic> response = await env.orpc.callKw({
      'model': modelName,
      'method': 'web_search_read',
      'args': [],
      'kwargs': {
        'context': {'bin_size': true},
        'domain': domain,
        'fields': OdooRecord.oFields,
        'limit': limit,
        'offset': offset,
        'order': order
      },
    });
    remoteRecordsCount = response['length'] as int;
    return response['records'] as List<dynamic>;
  } on Exception {
    remoteRecordsCount = 0;
    return [];
  }
}