How to get Bytea field contents with python code
I created a model with field named 'data_xml' which is a Many2many field to ir.attachment model and I have been able to insert an encoded XML file in ir.attachment by using the code shown below and everything works perfect (i.e the file can be opened in the user interface by clicking on the corresponding file inside the 'data_xml' field). Now, I need to open files uploaded that way in order to process them with python code, however I am experiencing trouble when trying to restore contents of db_datas field (I undestand it is difficult to get the contents since it is a Bytea field).
I tried suggestions in
https://www.odoo.com/es_ES/forum/help-1/question/solved-convert-picture-bytea-to-binary-in-a-python-file-30561, however I haven't been able get the XML content inside the field. Can any body provide suggestions on how I should proceed to be able to restore the XML content?
Thanks in advance for your help.
xml_binary = base64.b64encode(xml_FILE)
recordnumber = self.number
ir_att_name_file='FILE-XML ' + ir_att_name_file + '.xml'
ir_att_datas_fname = ir_att_name_file
ir_att_res_model = 'office.model'
ir_att_res_name=record.number + ' ...'
ir_att_Index_content = '(u\'application\',)'
ir_att_file_size = 1000