19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:30:27 +01:00
parent d1963a3c3a
commit 2d3ee4855a
7430 changed files with 2687981 additions and 2965473 deletions

View file

@ -4,6 +4,7 @@ import json
from collections import deque
from werkzeug.datastructures import FileStorage
from werkzeug.exceptions import UnprocessableEntity
from odoo import http, _
from odoo.http import content_disposition, request
@ -16,6 +17,8 @@ class TableExporter(http.Controller):
def export_xlsx(self, data, **kw):
import xlsxwriter # noqa: PLC0415
jdata = json.load(data) if isinstance(data, FileStorage) else json.loads(data)
if not jdata:
raise UnprocessableEntity(_('No data to export'))
output = io.BytesIO()
workbook = xlsxwriter.Workbook(output, {'in_memory': True})
worksheet = workbook.add_worksheet(jdata['title'])
@ -24,7 +27,7 @@ class TableExporter(http.Controller):
header_plain = workbook.add_format({'pattern': 1, 'bg_color': '#AAAAAA'})
bold = workbook.add_format({'bold': True})
measure_count = jdata['measure_count']
measure_count = min(jdata['measure_count'], 100000)
# Step 1: writing col group headers
col_group_headers = jdata['col_group_headers']
@ -43,11 +46,12 @@ class TableExporter(http.Controller):
if cell['height'] > 1:
carry.append({'x': x, 'height': cell['height'] - 1})
x = x + measure_count
for j in range(header['width']):
width = min(header['width'], 100000)
for j in range(width):
worksheet.write(y, x + j, header['title'] if j == 0 else '', header_plain)
if header['height'] > 1:
carry.append({'x': x, 'height': header['height'] - 1})
x = x + header['width']
x = x + width
while (carry and carry[0]['x'] == x):
cell = carry.popleft()
for j in range(measure_count):