From 2335aecfda94502748bb2a3f0c4e1adf6857e824 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 9 Dec 2013 14:34:10 +0100 Subject: [PATCH] On OpenERP 7, when you have the document module installed and you download the attachement via the drop down list on the form view, the name of the file will be the name of the attachement and not datas_fname ; so we need to have name = datas_fname. --- intrastat_base/intrastat_common.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/intrastat_base/intrastat_common.py b/intrastat_base/intrastat_common.py index 681f03a..7a21a62 100644 --- a/intrastat_base/intrastat_common.py +++ b/intrastat_base/intrastat_common.py @@ -95,12 +95,11 @@ class report_intrastat_common(orm.TransientModel): import base64 assert len(ids) == 1, "Only one ID accepted" filename = datetime.strftime(start_date_datetime, '%Y-%m') + '_' + declaration_name + '.xml' - attach_name = declaration_name.upper() + ' ' + datetime.strftime(start_date_datetime, '%Y-%m') attach_obj = self.pool.get('ir.attachment') if not context: context = {} context.update({'default_res_id': ids[0], 'default_res_model': object._name}) - attach_id = attach_obj.create(cr, uid, {'name': attach_name, 'datas': base64.encodestring(xml_string), 'datas_fname': filename}, context=context) + attach_id = attach_obj.create(cr, uid, {'name': filename, 'datas': base64.encodestring(xml_string), 'datas_fname': filename}, context=context) return attach_id def _open_attach_view(self, cr, uid, attach_id, title='XML file', context=None):