From 46a4f1d46f502bbb54063d609c08ccb2c2736b3b Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Sat, 16 Sep 2023 17:51:50 +0200 Subject: [PATCH 1/2] [IMP][16.0]improve creation of INI letter --- account_ebics/models/ebics_userid.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/account_ebics/models/ebics_userid.py b/account_ebics/models/ebics_userid.py index 931c0d5..b741f4d 100644 --- a/account_ebics/models/ebics_userid.py +++ b/account_ebics/models/ebics_userid.py @@ -403,23 +403,15 @@ class EbicsUserID(models.Model): else: lang = self.env.user.lang or self.env["res.lang"].search([])[0].code lang = lang[:2] - tmp_dir = os.path.normpath(self.ebics_config_id.ebics_keys + "/tmp") - if not os.path.isdir(tmp_dir): - os.makedirs(tmp_dir, mode=0o700) fn_date = fields.Date.today().isoformat() fn = "_".join([self.ebics_config_id.ebics_host, "ini_letter", fn_date]) + ".pdf" - full_tmp_fn = os.path.normpath(tmp_dir + "/" + fn) - user.create_ini_letter( - bankname=ebics_config_bank.name, path=full_tmp_fn, lang=lang + letter = user.create_ini_letter(bankname=ebics_config_bank.name, lang=lang) + self.write( + { + "ebics_ini_letter": base64.encodebytes(letter), + "ebics_ini_letter_fn": fn, + } ) - with open(full_tmp_fn, "rb") as f: - letter = f.read() - self.write( - { - "ebics_ini_letter": base64.encodebytes(letter), - "ebics_ini_letter_fn": fn, - } - ) return self.write({"state": "init"}) From ba888365011df5f0898936e46d137038bde62773 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Sat, 16 Sep 2023 18:22:00 +0200 Subject: [PATCH 2/2] [IMP][16.0]remove unused code in ebics_init_3 --- account_ebics/models/ebics_userid.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/account_ebics/models/ebics_userid.py b/account_ebics/models/ebics_userid.py index b741f4d..64d47c4 100644 --- a/account_ebics/models/ebics_userid.py +++ b/account_ebics/models/ebics_userid.py @@ -471,9 +471,6 @@ class EbicsUserID(models.Model): raise UserError(error) from err public_bank_keys = public_bank_keys.encode() - tmp_dir = os.path.normpath(self.ebics_config_id.ebics_keys + "/tmp") - if not os.path.isdir(tmp_dir): - os.makedirs(tmp_dir, mode=0o700) fn_date = fields.Date.today().isoformat() fn = ( "_".join([self.ebics_config_id.ebics_host, "public_bank_keys", fn_date])