[IMP] account_financial_report: black, isort

This commit is contained in:
Ernesto Tejeda
2020-03-23 11:14:52 -04:00
committed by chaule97
parent 1227d53d4f
commit 40c874a112
57 changed files with 7565 additions and 6087 deletions

View File

@@ -2,7 +2,7 @@
display: table !important;
background-color: white;
}
.act_as_row {
.act_as_row {
display: table-row !important;
page-break-inside: avoid;
}
@@ -16,67 +16,77 @@
.act_as_tbody {
display: table-row-group !important;
}
.list_table, .data_table, .totals_table{
.list_table,
.data_table,
.totals_table {
width: 100% !important;
}
.act_as_row.labels {
background-color:#F0F0F0 !important;
background-color: #f0f0f0 !important;
}
.list_table, .data_table, .totals_table, .list_table .act_as_row {
border-left:0px;
border-right:0px;
text-align:center;
font-size:10px;
padding-right:3px;
padding-left:3px;
padding-top:2px;
padding-bottom:2px;
border-collapse:collapse;
.list_table,
.data_table,
.totals_table,
.list_table .act_as_row {
border-left: 0px;
border-right: 0px;
text-align: center;
font-size: 10px;
padding-right: 3px;
padding-left: 3px;
padding-top: 2px;
padding-bottom: 2px;
border-collapse: collapse;
}
.totals_table {
font-weight: bold;
text-align: center;
}
.list_table .act_as_row.labels, .list_table .act_as_row.initial_balance, .list_table .act_as_row.lines {
border-color:grey !important;
border-bottom:1px solid lightGrey !important;
.list_table .act_as_row.labels,
.list_table .act_as_row.initial_balance,
.list_table .act_as_row.lines {
border-color: grey !important;
border-bottom: 1px solid lightGrey !important;
}
.data_table .act_as_cell{
.data_table .act_as_cell {
border: 1px solid lightGrey;
text-align: center;
}
.data_table .act_as_cell, .list_table .act_as_cell, .totals_table .act_as_cell {
.data_table .act_as_cell,
.list_table .act_as_cell,
.totals_table .act_as_cell {
word-wrap: break-word;
}
.data_table .act_as_row.labels, .totals_table .act_as_row.labels {
.data_table .act_as_row.labels,
.totals_table .act_as_row.labels {
font-weight: bold;
}
.initial_balance .act_as_cell {
font-style:italic;
font-style: italic;
}
.account_title {
font-size:11px;
font-weight:bold;
font-size: 11px;
font-weight: bold;
}
.account_title.labels {
background-color:#F0F0F0 !important;
background-color: #f0f0f0 !important;
}
.act_as_cell.amount {
word-wrap:normal;
text-align:right;
word-wrap: normal;
text-align: right;
}
.act_as_cell.left {
text-align:left;
text-align: left;
}
.act_as_cell.right {
text-align:right;
text-align: right;
}
.list_table .act_as_cell{
/* border-right:1px solid lightGrey; uncomment to active column lines */
.list_table .act_as_cell {
/* border-right:1px solid lightGrey; uncomment to active column lines */
}
.list_table .act_as_cell.first_column {
padding-left: 0px;
/* border-left:1px solid lightGrey; uncomment to active column lines */
/* border-left:1px solid lightGrey; uncomment to active column lines */
}
.overflow_ellipsis {
text-overflow: ellipsis;
@@ -84,7 +94,7 @@
white-space: nowrap;
}
.custom_footer {
font-size:7px !important;
font-size: 7px !important;
}
.page_break {
page-break-inside: avoid;

View File

@@ -1,21 +1,20 @@
odoo.define('account_financial_report.account_financial_report_backend', function (require) {
'use strict';
var core = require('web.core');
var Widget = require('web.Widget');
var ControlPanelMixin = require('web.ControlPanelMixin');
var ReportWidget = require(
'account_financial_report.account_financial_report_widget'
);
odoo.define("account_financial_report.account_financial_report_backend", function(
require
) {
"use strict";
var core = require("web.core");
var Widget = require("web.Widget");
var ControlPanelMixin = require("web.ControlPanelMixin");
var ReportWidget = require("account_financial_report.account_financial_report_widget");
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',
"click .o_account_financial_reports_print": "print",
"click .o_account_financial_reports_export": "export",
},
init: function (parent, action) {
init: function(parent, action) {
this.actionManager = parent;
this.given_context = {};
this.odoo_context = action.context;
@@ -23,50 +22,49 @@ odoo.define('account_financial_report.account_financial_report_backend', functio
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.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 () {
willStart: function() {
return $.when(this.get_html());
},
set_html: function () {
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 () {
def.then(function() {
self.report_widget.$el.html(self.html);
});
},
start: function () {
start: function() {
this.set_html();
return this._super();
},
// Fetches the html and is previous report.context if any,
// else create it
get_html: function () {
get_html: function() {
var self = this;
var defs = [];
return this._rpc({
model: this.given_context.model,
method: 'get_html',
method: "get_html",
args: [self.given_context],
context: self.odoo_context,
})
.then(function (result) {
self.html = result.html;
defs.push(self.update_cp());
return $.when.apply($, defs);
});
}).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 () {
update_cp: function() {
if (this.$buttons) {
var status = {
breadcrumbs: this.actionManager.get_breadcrumbs(),
@@ -75,40 +73,37 @@ odoo.define('account_financial_report.account_financial_report_backend', functio
return this.update_control_panel(status);
}
},
do_show: function () {
do_show: function() {
this._super();
this.update_cp();
},
print: function () {
print: function() {
var self = this;
this._rpc({
model: this.given_context.model,
method: 'print_report',
args: [this.given_context.active_id, 'qweb-pdf'],
method: "print_report",
args: [this.given_context.active_id, "qweb-pdf"],
context: self.odoo_context,
}).then(function (result) {
}).then(function(result) {
self.do_action(result);
});
},
export: function () {
export: function() {
var self = this;
this._rpc({
model: this.given_context.model,
method: 'print_report',
args: [this.given_context.active_id, 'xlsx'],
method: "print_report",
args: [this.given_context.active_id, "xlsx"],
context: self.odoo_context,
}).then(function (result) {
}).then(function(result) {
self.do_action(result);
});
},
canBeRemoved: function () {
canBeRemoved: function() {
return $.when();
},
});
core.action_registry.add(
"account_financial_report_backend",
report_backend
);
core.action_registry.add("account_financial_report_backend", report_backend);
return report_backend;
});

View File

@@ -1,86 +1,88 @@
odoo.define('account_financial_report.account_financial_report_widget', function
(require) {
'use strict';
var Widget = require('web.Widget');
odoo.define("account_financial_report.account_financial_report_widget", function(
require
) {
"use strict";
var Widget = require("web.Widget");
var accountFinancialReportWidget = Widget.extend({
events: {
'click .o_account_financial_reports_web_action':
'boundLink',
'click .o_account_financial_reports_web_action_multi':
'boundLinkmulti',
'click .o_account_financial_reports_web_action_monetary':
'boundLinkMonetary',
'click .o_account_financial_reports_web_action_monetary_multi':
'boundLinkMonetarymulti',
"click .o_account_financial_reports_web_action": "boundLink",
"click .o_account_financial_reports_web_action_multi": "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);
},
start: function () {
start: function() {
return this._super.apply(this, arguments);
},
boundLink: function (e) {
var res_model = $(e.target).data('res-model');
var res_id = $(e.target).data('active-id');
boundLink: function(e) {
var res_model = $(e.target).data("res-model");
var res_id = $(e.target).data("active-id");
return this.do_action({
type: 'ir.actions.act_window',
type: "ir.actions.act_window",
res_model: res_model,
res_id: res_id,
views: [[false, 'form']],
target: 'current',
views: [[false, "form"]],
target: "current",
});
},
boundLinkmulti: function (e) {
var res_model = $(e.target).data('res-model');
var domain = $(e.target).data('domain');
boundLinkmulti: function(e) {
var res_model = $(e.target).data("res-model");
var domain = $(e.target).data("domain");
if (!res_model) {
res_model = $(e.target.parentElement).data('res-model');
res_model = $(e.target.parentElement).data("res-model");
}
if (!domain) {
domain = $(e.target.parentElement).data('domain');
domain = $(e.target.parentElement).data("domain");
}
return this.do_action({
type: 'ir.actions.act_window',
name: this._toTitleCase(res_model.split('.').join(' ')),
type: "ir.actions.act_window",
name: this._toTitleCase(res_model.split(".").join(" ")),
res_model: res_model,
domain: domain,
views: [[false, "list"], [false, "form"]],
target: 'current',
views: [
[false, "list"],
[false, "form"],
],
target: "current",
});
},
boundLinkMonetary: function (e) {
var res_model = $(e.target.parentElement).data('res-model');
var res_id = $(e.target.parentElement).data('active-id');
boundLinkMonetary: function(e) {
var res_model = $(e.target.parentElement).data("res-model");
var res_id = $(e.target.parentElement).data("active-id");
return this.do_action({
type: 'ir.actions.act_window',
type: "ir.actions.act_window",
res_model: res_model,
res_id: res_id,
views: [[false, 'form']],
target: 'current',
views: [[false, "form"]],
target: "current",
});
},
boundLinkMonetarymulti: function (e) {
var res_model = $(e.target.parentElement).data('res-model');
var domain = $(e.target.parentElement).data('domain');
boundLinkMonetarymulti: function(e) {
var res_model = $(e.target.parentElement).data("res-model");
var domain = $(e.target.parentElement).data("domain");
return this.do_action({
type: 'ir.actions.act_window',
type: "ir.actions.act_window",
res_model: res_model,
domain: domain,
views: [[false, "list"], [false, "form"]],
target: 'current',
views: [
[false, "list"],
[false, "form"],
],
target: "current",
});
},
_toTitleCase: function (str) {
return str.replace(/\w\S*/g, function (txt) {
return txt.charAt(0).toUpperCase() +
txt.substr(1).toLowerCase();
_toTitleCase: function(str) {
return str.replace(/\w\S*/g, function(txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
});
},
});
return accountFinancialReportWidget;
});