Convert report into bytes before storing
If the invoice report has a text output, we must encode it as utf-8 before storing it. And we do not need to convert to bytes the data read because Binary field is already doing that. issue10937 review376581002 (grafted from a22984e8d5324c2ee018fa9b91e89bb5cefefd4c) --HG-- branch : 6.0
This commit is contained in:
1 parent
9f05fe2e38
commit
b97127aa84
1 file changed
+3
-1
+3
-1
@@ -2769,7 +2769,7 @@ class InvoiceReport(Report):
|
||||
if invoice.invoice_report_cache:
|
||||
return (
|
||||
invoice.invoice_report_format,
|
||||
bytes(invoice.invoice_report_cache))
|
||||
invoice.invoice_report_cache)
|
||||
else:
|
||||
result = super()._execute(records, header, data, action)
|
||||
# If the invoice is posted or paid and the report not saved in
|
||||
@@ -2777,6 +2777,8 @@ class InvoiceReport(Report):
|
||||
# now in invoice_report_cache
|
||||
if invoice.state in {'posted', 'paid'} and invoice.type == 'out':
|
||||
format_, data = result
|
||||
if isinstance(data, str):
|
||||
data = bytes(data, 'utf-8')
|
||||
invoice.invoice_report_format = format_
|
||||
invoice.invoice_report_cache = \
|
||||
Invoice.invoice_report_cache.cast(data)
|
||||
|
||||
Reference in new issue
Block a user