Skip to Content
Menu
This question has been flagged
2 Replies
2598 Views

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
Discard
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
Discard
Related Posts Replies Views Activity
0
Oct 25
204
2
Aug 25
3750
1
Jul 25
1835
1
Aug 25
1153
0
May 25
2115