From 5b910352688e8dc5ca604f9666034c84b4e73674 Mon Sep 17 00:00:00 2001 From: Iryna Vyshnevska Date: Sun, 13 Jan 2019 18:28:00 +0200 Subject: [PATCH] [FIX] pylint --- .../report/abstract_report.py | 1 + .../report/open_items.py | 1 + .../account_financial_report_qweb_backend.js | 182 +++++++++--------- .../report/customer_activity_statement.py | 1 + 4 files changed, 96 insertions(+), 89 deletions(-) diff --git a/account_financial_report_qweb/report/abstract_report.py b/account_financial_report_qweb/report/abstract_report.py index 961f343d..447d17dc 100644 --- a/account_financial_report_qweb/report/abstract_report.py +++ b/account_financial_report_qweb/report/abstract_report.py @@ -13,6 +13,7 @@ class AbstractReport(models.AbstractModel): "Model %s is not transient, it cannot be vacuumed!" % self._name # Never delete rows used in last 5 minutes seconds = max(seconds, 300) + # pylint: disable=sql-injection query = """ DELETE FROM """ + self._table + """ WHERE diff --git a/account_financial_report_qweb/report/open_items.py b/account_financial_report_qweb/report/open_items.py index 7d1c879a..e8b72d4a 100644 --- a/account_financial_report_qweb/report/open_items.py +++ b/account_financial_report_qweb/report/open_items.py @@ -638,6 +638,7 @@ ORDER BY self._compute_account_cumul() def _compute_partner_cumul(self): + # pylint: disable=sql-injection where_condition_partner_by_account = """ WHERE id IN diff --git a/account_financial_report_qweb/static/src/js/account_financial_report_qweb_backend.js b/account_financial_report_qweb/static/src/js/account_financial_report_qweb_backend.js index 3712a8f1..1319c744 100644 --- a/account_financial_report_qweb/static/src/js/account_financial_report_qweb_backend.js +++ b/account_financial_report_qweb/static/src/js/account_financial_report_qweb_backend.js @@ -1,95 +1,99 @@ odoo.define('account_financial_report_qweb.account_financial_report_backend', function (require) { -'use strict'; + 'use strict'; -var core = require('web.core'); -var Widget = require('web.Widget'); -var ControlPanelMixin = require('web.ControlPanelMixin'); -var ReportWidget = require('account_financial_report_qweb.account_financial_report_widget'); -var Model = require('web.Model'); + var core = require('web.core'); + var Widget = require('web.Widget'); + var ControlPanelMixin = require('web.ControlPanelMixin'); + var ReportWidget = require( + 'account_financial_report_qweb.account_financial_report_widget'); + var Model = require('web.Model'); -var report_backend = Widget.extend(ControlPanelMixin, { - // Stores all the parameters of the action. - events: { - 'click .o_account_financial_reports_print': 'print', - 'click .o_account_financial_reports_export': 'export', - }, - init: function(parent, action) { - this.actionManager = parent; - this.given_context = {}; - this.odoo_context = action.context; - this.controller_url = action.context.url; - if (action.context.context) { - this.given_context = action.context.context; - } - this.given_context.active_id = action.context.active_id || action.params.active_id; - this.given_context.model = action.context.active_model || false; - this.given_context.ttype = action.context.ttype || false; - return this._super.apply(this, arguments); - }, - willStart: function() { - return $.when(this.get_html()); - }, - set_html: function() { - var self = this; - var def = $.when(); - if (!this.report_widget) { - this.report_widget = new ReportWidget(this, this.given_context); - def = this.report_widget.appendTo(this.$el); - } - def.then(function () { - self.report_widget.$el.html(self.html); - }); - }, - start: function() { - this.set_html(); - return this._super(); - }, - // Fetches the html and is previous report.context if any, else create it - get_html: function() { - var self = this; - var defs = []; - self.model = new Model(this.given_context.model); - return self.model.call('get_html', [this.given_context], {context: self.odoo_context}).then(function - (result) { - self.html = result.html; - defs.push(self.update_cp()); - return $.when.apply($, defs); - }); - }, - // Updates the control panel and render the elements that have yet to be rendered - update_cp: function() { - if (!this.$buttons) { + var report_backend = Widget.extend(ControlPanelMixin, { + // Stores all the parameters of the action. + events: { + 'click .o_account_financial_reports_print': 'print', + 'click .o_account_financial_reports_export': 'export', + }, + init: function (parent, action) { + this.actionManager = parent; + this.given_context = {}; + this.odoo_context = action.context; + this.controller_url = action.context.url; + if (action.context.context) { + this.given_context = action.context.context; + } + this.given_context.active_id = action.context.active_id || + action.params.active_id; + this.given_context.model = action.context.active_model || false; + this.given_context.ttype = action.context.ttype || false; + return this._super.apply(this, arguments); + }, + willStart: function () { + return $.when(this.get_html()); + }, + set_html: function () { + var self = this; + var def = $.when(); + if (!this.report_widget) { + this.report_widget = new ReportWidget(this, this.given_context); + def = this.report_widget.appendTo(this.$el); + } + def.then(function () { + self.report_widget.$el.html(self.html); + }); + }, + start: function () { + this.set_html(); + return this._super(); + }, + // Fetches the html and is previous report.context if any, + // else create it + get_html: function () { + var self = this; + var defs = []; + self.model = new Model(this.given_context.model); + return self.model.call('get_html', [this.given_context], + {context: self.odoo_context}).then(function (result) { + self.html = result.html; + defs.push(self.update_cp()); + return $.when.apply($, defs); + }); + }, + // Updates the control panel and render the elements that have yet to + // be rendered + update_cp: function () { + var status = { + breadcrumbs: this.actionManager.get_breadcrumbs(), + cp_content: {$buttons: this.$buttons}, + }; + return this.update_control_panel(status); + }, + do_show: function () { + this._super(); + this.update_cp(); + }, + print: function () { + var self = this; + self.model = new Model(this.given_context.model); + self.model.call('print_report', [this.given_context.active_id, + 'qweb-pdf'], {context: self.odoo_context}) + .then(function (result) { + self.do_action(result); + }); + }, + export: function () { + var self = this; + self.model = new Model(this.given_context.model); + self.model.call('print_report', [this.given_context.active_id, + 'xlsx'], {context: self.odoo_context}) + .then(function (result) { + self.do_action(result); + }); + }, + }); - } - var status = { - breadcrumbs: this.actionManager.get_breadcrumbs(), - cp_content: {$buttons: this.$buttons}, - }; - return this.update_control_panel(status); - }, - do_show: function() { - this._super(); - this.update_cp(); - }, - print: function() { - var self = this; - self.model = new Model(this.given_context.model); - self.model.call('print_report', [this.given_context.active_id, 'qweb-pdf'], {context: self.odoo_context}) - .then(function(result){ - self.do_action(result); - }); - }, - export: function() { - var self = this; - self.model = new Model(this.given_context.model); - self.model.call('print_report', [this.given_context.active_id, 'xlsx'], {context: self.odoo_context}) - .then(function(result){ - self.do_action(result); - }); - }, -}); - -core.action_registry.add("account_financial_report_backend", report_backend); -return report_backend; + core.action_registry.add("account_financial_report_backend", + report_backend); + return report_backend; }); diff --git a/customer_activity_statement/report/customer_activity_statement.py b/customer_activity_statement/report/customer_activity_statement.py index 38ebd9c8..5e3a9259 100644 --- a/customer_activity_statement/report/customer_activity_statement.py +++ b/customer_activity_statement/report/customer_activity_statement.py @@ -101,6 +101,7 @@ class CustomerActivityStatement(models.AbstractModel): def _get_account_display_lines(self, company_id, partner_ids, date_start, date_end): + # pylint: disable=sql-injection res = dict(map(lambda x: (x, []), partner_ids)) partners = ', '.join([str(i) for i in partner_ids]) date_start = datetime.strptime(