Towards idiomatic Python with types for the Odoo ORM
Project description
typodoo
Towards idiomatic Python with types for Odoo models.
/!\ This is pre-alpha stuff /!\
Usage
pip install typodoo
Then, you can still write this, as usual:
from odoo import models, fields
class ResPartner(models.Model):
_inherit = "res.partner"
friend = fields.Boolean()
industry2_id = fields.Many2one(
'res.partner.industry',
string='Secondary Industry',
required=True,
)
But you can also write this:
from odoo import fields
from odoo.addons.base.models.res_partner import (
Partner, ResPartnerIndustry
)
class ResPartner(Partner, extends=True):
friend: bool = fields.Boolean()
industry2_id: ResPartnerIndustry = fields.Many2one(
string='Secondary Industry',
required=True,
)
But also this:
from odoo.addons.my_addon.models.res_partner import ResPartner
partners = ResPartner(self.env).search([])
Why?
Idiomatic python.
Native auto completion in IDEs.
Static type checking.
Development
pip install -e .
Then, copy typodoo_activate.pth
to $VIRTUAL_ENV/lib/python3.10/site-packages
.
Make this done automatically by the build backend is a TODO.
License
typodoo
is distributed under the terms of the
MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
typodoo-0.1.tar.gz
(4.7 kB
view details)
Built Distribution
typodoo-0.1-py3-none-any.whl
(4.1 kB
view details)
File details
Details for the file typodoo-0.1.tar.gz
.
File metadata
- Download URL: typodoo-0.1.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0f502118a5ad05a3a27cef34717783f4cf4208e6b96bbd1a68fa90a9656f549 |
|
MD5 | 6f2b603ab6960a7c79ee480292cbd831 |
|
BLAKE2b-256 | c4a1230e18154415ffa89cdd862fe310f4af7ac95442cfe5a43f75e4f6b633d9 |
File details
Details for the file typodoo-0.1-py3-none-any.whl
.
File metadata
- Download URL: typodoo-0.1-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fecd603d47f0f8aecb302545542140d3f5a954456c72b12f9393df4c7ff2c490 |
|
MD5 | f4d6542ffb5d748147627a2e8451f635 |
|
BLAKE2b-256 | cdbcb6856fbd85f525c7a8c60536ef99cf9b9692931782e7053f644794ed3ed9 |