Hello, I was trying to understand decorator @api.dependens_context in odoo but I didn't find any document explaining it clearly can anyone explain it clearly with example and what is used for, Thanks and BR.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Comptabilité
- Inventaire
- PoS
- Project
- MRP
Cette question a été signalée
2
Réponses
2093
Vues
Hi,
Here is the link to the documentation:
Hope it helps
Hello ZiadHamdii
We use the ''@api.depends_context'' decorator for non-stored ‘compute’ methods to indicate the context dependencies for these methods.
The arguments passed will be the key in the context’s dictionary.
example:
@api.depends_context('company')
def _compute_currency_id(self): self.currency_id = self.env.company.currency_id
Thanks!!
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !
Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !
S'inscrirePublications associées | Réponses | Vues | Activité | |
---|---|---|---|---|
|
2
août 25
|
2552 | ||
|
1
juil. 25
|
964 | ||
|
1
août 25
|
1151 | ||
|
0
mai 25
|
1405 | ||
|
2
avr. 25
|
3597 |