As per odoo convention, we call a model instance this way
Partner = self.env['res.partner']
IDE can not suggest the methods `res.partner` model has. One reason is, `res.partner` is the value of _name attribute of original pythonic Model class name. In Odoo development, that pythonic glass name has no use. But I suspect, this class name is somehow important for typing annotation.
I would love to use this if I could import ResPartnerClass where ResPartnerClass is the pythonic Model class name of res.partner model,
Partner: ResPartnerClass = self.env['res.partner']
But finding and importing ResPartnerClass is a non-trivial job to perform since it is an internal module.
Does anybody know the solution regarding this problem?
Deze vraag is gerapporteerd
Python versions less than 3.11, the Self type is available in typing_extensions . You import the Self type from typing in line 3 and annotate
If you are using PyCharm, I would recommend trying the "Odoo Framework Integration for PyCharm" Plugin by Trịnh Anh Ngọc.
It has some cost associated with it, but for me, it is worth it.
PS: Not affiliated; just a happy user. :)
PPS: I cannot post links yet due to missing Karma, but it should be the first hit on Google.
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
Aanmelden| Gerelateerde posts | Antwoorden | Weergaven | Activiteit | |
|---|---|---|---|---|
|
|
0
jan. 23
|
2216 |