fromJson static method
Used to restore a call from persistant call queue.
Implementation
static OdooRpcCall fromJson(Map<String, dynamic> jsonMap) {
final callJson = json.encode(jsonMap, toEncodable: (value) {
if (value is DateTime) {
return value.toIso8601String();
}
if (value is OdooId) {
return value.toJson();
}
return value;
});
return json.decode(callJson, reviver: (key, value) {
if (value is Map) {
if (value.containsKey('userId')) {
return OdooRpcCall(
value['userId'] as int,
value['baseURL'] as String,
value['dbName'] as String,
value['modelName'] as String,
value['recordId'] as int,
value['method'] as String,
value['args'] as dynamic,
value['kwargs'] as Map<dynamic, dynamic>,
DateTime.parse(value['callDate']),
);
}
if (value.containsKey('odooModel') && value.containsKey('odooId')) {
return OdooId(value['odooModel'] as String, value['odooId'] as int);
}
}
return value;
});
}