تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
2106 أدوات العرض

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


الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
أغسطس 25
2556
1
يوليو 25
968
1
أغسطس 25
1151
0
مايو 25
1407
2
أبريل 25
3597