Set the target field name in the context to get the size

The getter of 'data_size' field must use the name 'data' in the context instead
of 'data_size'.

issue10849
review383301002
This commit is contained in:
Cédric Krier committed 2021-10-19 00:22:08 +02:00
1 parent 867536be18
commit e644d6a4eb
1 file changed
+1 -1
+1 -1
View File
@@ -88,7 +88,7 @@ class Attachment(ResourceMixin, ModelSQL, ModelView):
def get_size(self, name):
with Transaction().set_context({
'%s.%s' % (self.__name__, name): 'size',
'%s.%s' % (self.__name__, name[:-len('_size')]): 'size',
}):
record = self.__class__(self.id)
return record.data