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?
Această întrebare a fost marcată
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.
Îți place discuția? Nu doar citi, alătură-te!
Creează-ți un cont astăzi pentru a beneficia de funcții exclusive și a interacționa cu minunata noastră comunitate!
Înscrie-te| Postări similare | Răspunsuri | Vizualizări | Activitate | |
|---|---|---|---|---|
|
|
0
ian. 23
|
2250 |