mirror of
https://github.com/brain-tec/account_ebics.git
synced 2024-11-27 14:37:25 +00:00
[IMP][16.0]improve creation of INI letter
This commit is contained in:
parent
467e139a18
commit
46a4f1d46f
@ -403,17 +403,9 @@ 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
|
||||
)
|
||||
with open(full_tmp_fn, "rb") as f:
|
||||
letter = f.read()
|
||||
letter = user.create_ini_letter(bankname=ebics_config_bank.name, lang=lang)
|
||||
self.write(
|
||||
{
|
||||
"ebics_ini_letter": base64.encodebytes(letter),
|
||||
|
Loading…
Reference in New Issue
Block a user