From 45b23bb887bda9957da9b278433467853055c109 Mon Sep 17 00:00:00 2001 From: xtof Date: Mon, 9 Jul 2018 12:59:33 +0200 Subject: [PATCH] [ADD] enable the use of the same file by several configuration (naive implementation of issue #52) --- goufi_base/models/import_configuration.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/goufi_base/models/import_configuration.py b/goufi_base/models/import_configuration.py index e3e2f87..c5054b5 100644 --- a/goufi_base/models/import_configuration.py +++ b/goufi_base/models/import_configuration.py @@ -164,6 +164,8 @@ def action_open_tabs_view(self): # file detection def detect_files(self, cr=None, uid=None, context=None, cur_dir=None): + self.ensure_one() + file_model = self.env['goufi.import_file'] delete_files_val = self.env['ir.config_parameter'].get_param('goufi.delete_obsolete_files') delete_files = True if delete_files_val == 'True' else False @@ -206,7 +208,7 @@ def detect_files(self, cr=None, uid=None, context=None, cur_dir=None): filesize = os.path.getsize(cur_path) str_date = dateToOdooString(datetime.now()) - existing_found = file_model.search([('filename', '=', cur_path)]) + existing_found = file_model.search([('filename', '=', cur_path), ('import_config', '=', self.id)]) nb_found = len(existing_found) if nb_found == 1: