[FIX] pylint
parent
3e0da15199
commit
8b894d0c0b
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -1,19 +1,21 @@
|
||||||
odoo.define('account_financial_report.account_financial_report_backend', function (require) {
|
odoo.define('account_financial_report.account_financial_report_backend', function (require) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
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, {
|
||||||
// Stores all the parameters of the action.
|
// Stores all the parameters of the action.
|
||||||
events: {
|
events: {
|
||||||
'click .o_account_financial_reports_print': 'print',
|
'click .o_account_financial_reports_print': 'print',
|
||||||
'click .o_account_financial_reports_export': 'export',
|
'click .o_account_financial_reports_export': 'export',
|
||||||
},
|
},
|
||||||
init: function(parent, action) {
|
init: function (parent, action) {
|
||||||
this.actionManager = parent;
|
this.actionManager = parent;
|
||||||
this.given_context = {};
|
this.given_context = {};
|
||||||
this.odoo_context = action.context;
|
this.odoo_context = action.context;
|
||||||
|
@ -21,15 +23,16 @@ 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);
|
||||||
},
|
},
|
||||||
willStart: function() {
|
willStart: function () {
|
||||||
return $.when(this.get_html());
|
return $.when(this.get_html());
|
||||||
},
|
},
|
||||||
set_html: function() {
|
set_html: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
var def = $.when();
|
var def = $.when();
|
||||||
if (!this.report_widget) {
|
if (!this.report_widget) {
|
||||||
|
@ -60,8 +63,9 @@ 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
|
||||||
update_cp: function() {
|
// to be rendered
|
||||||
|
update_cp: function () {
|
||||||
if (this.$buttons) {
|
if (this.$buttons) {
|
||||||
var status = {
|
var status = {
|
||||||
breadcrumbs: this.actionManager.get_breadcrumbs(),
|
breadcrumbs: this.actionManager.get_breadcrumbs(),
|
||||||
|
@ -70,11 +74,11 @@ var report_backend = Widget.extend(ControlPanelMixin, {
|
||||||
return this.update_control_panel(status);
|
return this.update_control_panel(status);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
do_show: function() {
|
do_show: function () {
|
||||||
this._super();
|
this._super();
|
||||||
this.update_cp();
|
this.update_cp();
|
||||||
},
|
},
|
||||||
print: function() {
|
print: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
this._rpc({
|
this._rpc({
|
||||||
model: this.given_context.model,
|
model: this.given_context.model,
|
||||||
|
@ -85,7 +89,7 @@ var report_backend = Widget.extend(ControlPanelMixin, {
|
||||||
self.do_action(result);
|
self.do_action(result);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
export: function() {
|
export: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
this._rpc({
|
this._rpc({
|
||||||
model: this.given_context.model,
|
model: this.given_context.model,
|
||||||
|
@ -97,8 +101,11 @@ var report_backend = Widget.extend(ControlPanelMixin, {
|
||||||
self.do_action(result);
|
self.do_action(result);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
core.action_registry.add("account_financial_report_backend", report_backend);
|
core.action_registry.add(
|
||||||
return report_backend;
|
"account_financial_report_backend",
|
||||||
|
report_backend
|
||||||
|
);
|
||||||
|
return report_backend;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
odoo.define('account_financial_report.account_financial_report_widget', function
|
odoo.define('account_financial_report.account_financial_report_widget', function
|
||||||
(require) {
|
(require) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var Widget = require('web.Widget');
|
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);
|
||||||
},
|
},
|
||||||
start: function() {
|
start: function () {
|
||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
boundLink: function(e) {
|
boundLink: function (e) {
|
||||||
var res_model = $(e.target).data('res-model');
|
var res_model = $(e.target).data('res-model');
|
||||||
var res_id = $(e.target).data('active-id');
|
var res_id = $(e.target).data('active-id');
|
||||||
return this.do_action({
|
return this.do_action({
|
||||||
|
@ -26,10 +30,10 @@ 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) {
|
||||||
var res_model = $(e.target).data('res-model');
|
var res_model = $(e.target).data('res-model');
|
||||||
var domain = $(e.target).data('domain');
|
var domain = $(e.target).data('domain');
|
||||||
return this.do_action({
|
return this.do_action({
|
||||||
|
@ -37,10 +41,10 @@ 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) {
|
||||||
var res_model = $(e.target.parentElement).data('res-model');
|
var res_model = $(e.target.parentElement).data('res-model');
|
||||||
var res_id = $(e.target.parentElement).data('active-id');
|
var res_id = $(e.target.parentElement).data('active-id');
|
||||||
return this.do_action({
|
return this.do_action({
|
||||||
|
@ -48,10 +52,10 @@ 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) {
|
||||||
var res_model = $(e.target.parentElement).data('res-model');
|
var res_model = $(e.target.parentElement).data('res-model');
|
||||||
var domain = $(e.target.parentElement).data('domain');
|
var domain = $(e.target.parentElement).data('domain');
|
||||||
return this.do_action({
|
return this.do_action({
|
||||||
|
@ -59,11 +63,11 @@ 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',
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return accountFinancialReportWidget;
|
return accountFinancialReportWidget;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue