[MIG] pingen: Migration to 16.0

Standard migration, incl. changes proposed in https://github.com/OCA/report-print-send/pull/290/
Add unit test.
This commit is contained in:
Anna Janiszewska
2023-01-30 14:46:41 +01:00
parent b72b28f004
commit 0d8676547a
27 changed files with 2401 additions and 372 deletions

View File

@@ -1,5 +1,5 @@
# Author: Guewen Baconnier
# Copyright 2012-2017 Camptocamp SA
# Copyright 2012-2023 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import base64
@@ -22,7 +22,6 @@ class IrAttachment(models.Model):
def _prepare_pingen_document_vals(self):
return {
"attachment_id": self.id,
# 'config': 'created from attachment'
}
def _handle_pingen_document(self):
@@ -67,7 +66,6 @@ class IrAttachment(models.Model):
attachment._handle_pingen_document()
return attachment
@api.multi
def write(self, vals):
res = super(IrAttachment, self).write(vals)
if "send_to_pingen" in vals:
@@ -83,7 +81,7 @@ class IrAttachment(models.Model):
if self.type == "binary":
decoded_document = base64.b64decode(self.datas)
elif self.type == "url":
response = requests.get(self.url)
response = requests.get(self.url, timeout=30)
if response.ok:
decoded_document = requests.content
else: