Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
2120 Переглядів

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.




Аватар
Відмінити
Найкраща відповідь

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


Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
2
серп. 25
2569
1
лип. 25
977
1
серп. 25
1151
0
трав. 25
1421
2
квіт. 25
3602