[MIG] account_financial_report: Migration to 12.0

[IMP] Reformated one query to avoid one sql injection warning message - but no sql injection was possible here
This commit is contained in:
Wolfgang Pichler
2019-01-16 19:38:26 +01:00
committed by chaule97
parent 3de3a119e5
commit 9f9211b6ea
20 changed files with 86 additions and 61 deletions

View File

@@ -14,9 +14,9 @@ class AbstractReport(models.AbstractModel):
# Never delete rows used in last 5 minutes
seconds = max(seconds, 300)
query = """
DELETE FROM """ + self._table + """
DELETE FROM %s
WHERE COALESCE(
write_date, create_date, (now() at time zone 'UTC'))::timestamp
< ((now() at time zone 'UTC') - interval %s)
"""
self.env.cr.execute(query, ("%s seconds" % seconds,))
self.env.cr.execute(query, (self._table, "%s seconds" % seconds,))

View File

@@ -3,6 +3,8 @@
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
import datetime
class AbstractReportXslx(models.AbstractModel):
@@ -188,6 +190,8 @@ class AbstractReportXslx(models.AbstractModel):
"""
for col_pos, column in self.columns.items():
value = getattr(line_object, column['field'])
if isinstance(value, datetime.date):
value = datetime.datetime.strftime(value, DEFAULT_SERVER_DATE_FORMAT)
cell_type = column.get('type', 'string')
if cell_type == 'many2one':
self.sheet.write_string(

View File

@@ -195,7 +195,7 @@ class AgedPartnerBalanceReportCompute(models.TransientModel):
report = self.env['ir.actions.report'].search(
[('report_name', '=', report_name),
('report_type', '=', report_type)], limit=1)
return report.report_action(self)
return report.report_action(self, config=False)
def _get_html(self):
result = {}

View File

@@ -224,7 +224,7 @@ class GeneralLedgerReportCompute(models.TransientModel):
'report_general_ledger_qweb'
return self.env['ir.actions.report'].search(
[('report_name', '=', report_name),
('report_type', '=', report_type)], limit=1).report_action(self)
('report_type', '=', report_type)], limit=1).report_action(self, config=False)
def _get_html(self):
result = {}

View File

@@ -594,7 +594,7 @@ class ReportJournalLedger(models.TransientModel):
'report_journal_ledger_qweb'
return self.env['ir.actions.report'].search(
[('report_name', '=', report_name),
('report_type', '=', report_type)], limit=1).report_action(self)
('report_type', '=', report_type)], limit=1).report_action(self, config=False)
def _get_html(self):
result = {}

View File

@@ -160,7 +160,7 @@ class OpenItemsReportCompute(models.TransientModel):
'report_open_items_qweb'
return self.env['ir.actions.report'].search(
[('report_name', '=', report_name),
('report_type', '=', report_type)], limit=1).report_action(self)
('report_type', '=', report_type)], limit=1).report_action(self, config=False)
def _get_html(self):
result = {}

View File

@@ -209,7 +209,7 @@ class TrialBalanceReportCompute(models.TransientModel):
'report_trial_balance_qweb'
return self.env['ir.actions.report'].search(
[('report_name', '=', report_name),
('report_type', '=', report_type)], limit=1).report_action(self)
('report_type', '=', report_type)], limit=1).report_action(self, config=False)
def _get_html(self):
result = {}
@@ -410,7 +410,7 @@ SELECT
accgroup.parent_id,
coalesce(accgroup.code_prefix, accgroup.name),
accgroup.name,
accgroup.parent_left * 100000,
accgroup.id * 100000,
accgroup.level
FROM
account_group accgroup"""

View File

@@ -112,7 +112,7 @@ class VATReportCompute(models.TransientModel):
action = self.env['ir.actions.report'].search(
[('report_name', '=', report_name),
('report_type', '=', report_type)], limit=1)
return action.with_context(context).report_action(self)
return action.with_context(context).report_action(self, config=False)
def _get_html(self):
result = {}