1
0
forked from Mapan/odoo17e
odoo17e-kedaikipas58/addons/sale_pdf_quote_builder/utils.py
2024-12-10 09:04:09 +07:00

16 lines
507 B
Python

# Part of Odoo. See LICENSE file for full copyright and licensing details.
import io
from odoo import _
from odoo.exceptions import ValidationError
from odoo.tools import pdf
def _ensure_document_not_encrypted(document):
if pdf.PdfFileReader(io.BytesIO(document), strict=False).isEncrypted:
raise ValidationError(_(
"It seems that we're not able to process this pdf inside a quotation. It is either "
"encrypted, or encoded in a format we do not support."
))