mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-20 06:12:04 +02:00
19.0 vanilla
This commit is contained in:
parent
d1963a3c3a
commit
2d3ee4855a
7430 changed files with 2687981 additions and 2965473 deletions
|
|
@ -175,7 +175,7 @@ class Binary(http.Controller):
|
|||
'/web/image/<int:id>-<string:unique>/<string:filename>',
|
||||
'/web/image/<int:id>-<string:unique>/<int:width>x<int:height>',
|
||||
'/web/image/<int:id>-<string:unique>/<int:width>x<int:height>/<string:filename>',
|
||||
], type='http', auth='public', readonly=True)
|
||||
], type='http', auth='public', readonly=True, save_session=False)
|
||||
# pylint: disable=redefined-builtin,invalid-name
|
||||
def content_image(self, xmlid=None, model='ir.attachment', id=None, field='raw',
|
||||
filename_field='name', filename=None, mimetype=None, unique=False,
|
||||
|
|
|
|||
|
|
@ -312,7 +312,8 @@ class Export(http.Controller):
|
|||
definition_record = field['definition_record']
|
||||
definition_record_field = field['definition_record_field']
|
||||
|
||||
target_model = Model.env[Model._fields[definition_record].comodel_name]
|
||||
# sudo(): user may lack access to property definition model
|
||||
target_model = Model.env[Model._fields[definition_record].comodel_name].sudo()
|
||||
domain_definition = [(definition_record_field, '!=', False)]
|
||||
# Depends of the records selected to avoid showing useless Properties
|
||||
if domain:
|
||||
|
|
@ -566,7 +567,7 @@ class ExportFormat(object):
|
|||
groupby = params.get('groupby')
|
||||
if not import_compat and groupby:
|
||||
export_data = records.export_data(['.id'] + field_names).get('datas', [])
|
||||
groupby_type = [Model._fields[x.split(':')[0]].type for x in groupby]
|
||||
groupby_type = [Model._fields[x.split(':', 1)[0].split('.', 1)[0]].type for x in groupby]
|
||||
tree = GroupsTreeNode(Model, field_names, groupby, groupby_type)
|
||||
if ids:
|
||||
domain = [('id', 'in', ids)]
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue