Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
2629 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
nov 25
3096
0
nov 25
3
0
nov 25
192
0
oct 25
219
2
ago 25
3772