ERP-Ukraine / odoo-rpc-dart

Odoo RPC Library for Dart
MIT License
44 stars 35 forks source link

type 'Null' is not a subtype of type 'int' in type cast #46

Closed ShaoDaTao closed 7 months ago

ShaoDaTao commented 9 months ago

environment: sdk: '>=2.16.0' dependencies: odoo_rpc: ^0.4.5

code: main() async { final client = OdooClient('http://127.0.0.1:8069'); try { await client.authenticate('odoo17uat', 'admin', 'admin'); print(client); // final res = await client.callRPC('/web/session/modules', 'call', {}); // print('Installed modules: \n' + res.toString()); } on OdooException catch (e) { print(e); client.close(); exit(-1); } client.close(); }

err: Unhandled exception: type 'Null' is not a subtype of type 'int' in type cast

0 OdooSession.fromSessionInfo (package:odoo_rpc/src/odoo_session.dart:65:37)

1 OdooClient.authenticate (package:odoo_rpc/src/odoo_client.dart:262:32)

I traced the code, it successfully login, but this sentense throw err: _sessionId = OdooSession.fromSessionInfo(result['result']);
ernestoBizDirect commented 9 months ago

I had a similar error after successful authentication, in my case it has to do with the company_id column of the res.partner model that is not returned after authentication. For now I simply removed the field from this file that is specific to the package waiting for the problem to be resolved. image

lem8r commented 7 months ago

Thanks for reporting! Please upgrade to v 0.5.4