My Solution to this matter/problem, create first a compute field and its function
.py
filename = fields.Char('file name', readonly = True,store = False,compute ='legacy_doc1_getFilename')
@api.one
def legacy_doc1_getFilename(self):
if len(self.employee_number) > 0:
self.filename = str(self.employee_number) + '_ConfidentialReports.pdf'
else:
self.filename = 'filename_ConfidentialReports.pdf'
and in XML file just add the attribute file and the field
<page string="Legacy Documents">
<group>
<field name="filename" readonly="1" invisible="1"/>
<field name="legacy_doc_1" filename="filename"/>
</group>
</page>