I want to get a field translation in a specific language if it exists.
I saw some code that is just updating the context language before getting the field value so I tried but it’s returning me the default language value:
context = {}
if self.purchase and self.purchase.party and self.purchase.party.lang:
context['language'] = self.purchase.party.lang.code
with Transaction().set_context(context):
self.product_supplier.name
Assuming that exists a translation for the product supplier name and also that I am setting the expected lang code, should it works or I am missing something else?