sbidoul / typodoo

Towards idiomatic Python with types for Odoo models.
MIT License
38 stars 1 forks source link

What's the state of this repo #4

Open flotho opened 1 year ago

flotho commented 1 year ago

Hi @sbidoul ,

Thanks for this awesome work, I've discovered your talk in Odooexp22 and it was awesome! Is this repo the best place to test, share and report issues? Regards

sbidoul commented 1 year ago

@flotho you can test with this repo, together with this Odoo patch: https://github.com/odoo/odoo/pull/103227. We recently rebased it on the latest 16.0.

Of course to get the full benefits, the Odoo ORM patch needs to be elaborated a little bit, and then it must percolate to official addons. Maybe @rco-odoo can give an update about Odoo plans about this.

rvalyi commented 1 year ago

@sbidoul I was wondering: will we only benefit from the field type inference once all fields of all Odoo addons and OCA addons would be rewritten to the new syntax? Sadly it may take years, no?

Secondly, did you ever imagine the dream for migrating Odoo module if Pyright could reliability tell us all fields or methods that do not exist anymore on version N? even with a few false positive, checking the list of detected mistakes would save us an incredible amount of time. Same thing for Odoo SA. I could not understand if that is not a big priority for them... This is my most wanted Odoo feature today. I even keep the Floating point accounting to get this one in ;-)

rvalyi commented 1 year ago

one more question: it seems we can provide type checker some extra type declaration stubs files. Seems this is used for type inference with legacy libraries.

What about generating such stubs files in OCA/OCB automatically untill odoo/odoo start integrating the new field syntax?

sbidoul commented 1 year ago

@rvalyi yes, many things can be done. For instance it should be feasible and not that hard to write a script that automatically converts the model inheritance and m2x fields declarations. So there are ways to accelerate the conversions. Creating typing stubs for models.py fields.py and api.py may be feasible, but I'm not sure it's feasible for the official addons.