[FIX] pylint

pull/512/head
Iryna Vushnevska 2019-01-28 02:53:56 +02:00 committed by Iryna Vyshnevska
parent 3e0da15199
commit 8b894d0c0b
8 changed files with 177 additions and 161 deletions

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2019 ACSONE SA/NV (<http://acsone.eu>) # Copyright 2019 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).- # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).-
from odoo import api, models from odoo import api, models

View File

@ -638,6 +638,7 @@ ORDER BY
self._compute_account_cumul() self._compute_account_cumul()
def _compute_partner_cumul(self): def _compute_partner_cumul(self):
# pylint: disable=sql-injection
where_condition_partner_by_account = """ where_condition_partner_by_account = """
WHERE WHERE
id IN id IN

View File

@ -4,7 +4,9 @@ odoo.define('account_financial_report.account_financial_report_backend', functio
var core = require('web.core'); var core = require('web.core');
var Widget = require('web.Widget'); var Widget = require('web.Widget');
var ControlPanelMixin = require('web.ControlPanelMixin'); var ControlPanelMixin = require('web.ControlPanelMixin');
var ReportWidget = require('account_financial_report.account_financial_report_widget'); var ReportWidget = require(
'account_financial_report.account_financial_report_widget'
);
var report_backend = Widget.extend(ControlPanelMixin, { var report_backend = Widget.extend(ControlPanelMixin, {
@ -21,7 +23,8 @@ var report_backend = Widget.extend(ControlPanelMixin, {
if (action.context.context) { if (action.context.context) {
this.given_context = 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.active_id = action.context.active_id ||
action.params.active_id;
this.given_context.model = action.context.active_model || false; this.given_context.model = action.context.active_model || false;
this.given_context.ttype = action.context.ttype || false; this.given_context.ttype = action.context.ttype || false;
return this._super.apply (this, arguments); return this._super.apply (this, arguments);
@ -60,7 +63,8 @@ var report_backend = Widget.extend(ControlPanelMixin, {
return $.when.apply($, defs); return $.when.apply($, defs);
}); });
}, },
// Updates the control panel and render the elements that have yet to be rendered // Updates the control panel and render the elements that have yet
// to be rendered
update_cp: function () { update_cp: function () {
if (this.$buttons) { if (this.$buttons) {
var status = { var status = {
@ -99,6 +103,9 @@ var report_backend = Widget.extend(ControlPanelMixin, {
}, },
}); });
core.action_registry.add("account_financial_report_backend", report_backend); core.action_registry.add(
"account_financial_report_backend",
report_backend
);
return report_backend; return report_backend;
}); });

View File

@ -7,10 +7,14 @@ var Widget = require('web.Widget');
var accountFinancialReportWidget = Widget.extend({ var accountFinancialReportWidget = Widget.extend({
events: { events: {
'click .o_account_financial_reports_web_action': 'boundLink', 'click .o_account_financial_reports_web_action':
'click .o_account_financial_reports_web_action_multi': 'boundLinkmulti', 'boundLink',
'click .o_account_financial_reports_web_action_monetary': 'boundLinkMonetary', 'click .o_account_financial_reports_web_action_multi':
'click .o_account_financial_reports_web_action_monetary_multi': 'boundLinkMonetarymulti', 'boundLinkmulti',
'click .o_account_financial_reports_web_action_monetary':
'boundLinkMonetary',
'click .o_account_financial_reports_web_action_monetary_multi':
'boundLinkMonetarymulti',
}, },
init: function () { init: function () {
this._super.apply(this, arguments); this._super.apply(this, arguments);
@ -26,7 +30,7 @@ var accountFinancialReportWidget = Widget.extend({
res_model: res_model, res_model: res_model,
res_id: res_id, res_id: res_id,
views: [[false, 'form']], views: [[false, 'form']],
target: 'current' target: 'current',
}); });
}, },
boundLinkmulti: function (e) { boundLinkmulti: function (e) {
@ -37,7 +41,7 @@ var accountFinancialReportWidget = Widget.extend({
res_model: res_model, res_model: res_model,
domain: domain, domain: domain,
views: [[false, "list"], [false, "form"]], views: [[false, "list"], [false, "form"]],
target: 'current' target: 'current',
}); });
}, },
boundLinkMonetary: function (e) { boundLinkMonetary: function (e) {
@ -48,7 +52,7 @@ var accountFinancialReportWidget = Widget.extend({
res_model: res_model, res_model: res_model,
res_id: res_id, res_id: res_id,
views: [[false, 'form']], views: [[false, 'form']],
target: 'current' target: 'current',
}); });
}, },
boundLinkMonetarymulti: function (e) { boundLinkMonetarymulti: function (e) {
@ -59,7 +63,7 @@ var accountFinancialReportWidget = Widget.extend({
res_model: res_model, res_model: res_model,
domain: domain, domain: domain,
views: [[false, "list"], [false, "form"]], views: [[false, "list"], [false, "form"]],
target: 'current' target: 'current',
}); });
}, },
}); });

View File

@ -4,7 +4,6 @@
import time import time
from odoo.api import Environment
from odoo.tests import common from odoo.tests import common
from . import abstract_test_foreign_currency as a_t_f_c from . import abstract_test_foreign_currency as a_t_f_c
@ -505,9 +504,12 @@ class TestGeneralLedgerReport(common.TransactionCase):
partner_3.write({'is_company': False}) partner_3.write({'is_company': False})
expected_list = [partner_2.id, partner_3.id, partner_4.id] expected_list = [partner_2.id, partner_3.id, partner_4.id]
context = {'active_ids': [ context = {
partner_1.id, partner_2.id, partner_3.id, partner_4.id], 'active_ids': [
'active_model': 'res.partner'} partner_1.id, partner_2.id, partner_3.id, partner_4.id
],
'active_model': 'res.partner'
}
wizard = self.env["general.ledger.report.wizard"].with_context(context) wizard = self.env["general.ledger.report.wizard"].with_context(context)
self.assertEqual(wizard._default_partners(), expected_list) self.assertEqual(wizard._default_partners(), expected_list)

View File

@ -50,9 +50,12 @@ class TestOpenItems(a_t_f_c.AbstractTestForeignCurrency):
partner_3.write({'is_company': False}) partner_3.write({'is_company': False})
expected_list = [partner_2.id, partner_3.id, partner_4.id] expected_list = [partner_2.id, partner_3.id, partner_4.id]
context = {'active_ids': [ context = {
partner_1.id, partner_2.id, partner_3.id, partner_4.id], 'active_ids': [
'active_model': 'res.partner'} partner_1.id, partner_2.id, partner_3.id, partner_4.id
],
'active_model': 'res.partner'
}
wizard = self.env["open.items.report.wizard"].with_context(context) wizard = self.env["open.items.report.wizard"].with_context(context)
self.assertEqual(wizard._default_partners(), expected_list) self.assertEqual(wizard._default_partners(), expected_list)