Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odgovori
2107 Prikazi

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.




Avatar
Opusti
Best Answer

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!!


Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
2
avg. 25
2556
1
jul. 25
969
1
avg. 25
1151
0
maj 25
1407
2
apr. 25
3598