mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[IMP] web_pivot_computed_measure: black, isort, prettier
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
../../../../web_pivot_computed_measure
|
||||||
6
setup/web_pivot_computed_measure/setup.py
Normal file
6
setup/web_pivot_computed_measure/setup.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
||||||
@@ -112,19 +112,22 @@ odoo.define("web_pivot_computed_measure.PivotController", function(require) {
|
|||||||
if (this.$buttons_measures_ex && this.$buttons_measures_ex.length) {
|
if (this.$buttons_measures_ex && this.$buttons_measures_ex.length) {
|
||||||
this.$buttons_measures_ex.remove();
|
this.$buttons_measures_ex.remove();
|
||||||
}
|
}
|
||||||
const measures = _.sortBy(_.pairs(_.omit(this.measures, "__count")), x => {
|
const measures = _.sortBy(
|
||||||
|
_.pairs(_.omit(this.measures, "__count")),
|
||||||
|
(x) => {
|
||||||
return x[1].string.toLowerCase();
|
return x[1].string.toLowerCase();
|
||||||
});
|
}
|
||||||
|
);
|
||||||
this.$buttons_measures_ex = $(
|
this.$buttons_measures_ex = $(
|
||||||
QWeb.render("web_pivot_computed_measure.ExtendedMenu", {
|
QWeb.render("web_pivot_computed_measure.ExtendedMenu", {
|
||||||
isOpen: this.computed_measures_open,
|
isOpen: this.computed_measures_open,
|
||||||
debug: config.isDebug(),
|
debug: config.isDebug(),
|
||||||
measures: measures,
|
measures: measures,
|
||||||
computed_measures: _.map(
|
computed_measures: _.map(
|
||||||
_.reject(measures, item => {
|
_.reject(measures, (item) => {
|
||||||
return !item[1].__computed_id;
|
return !item[1].__computed_id;
|
||||||
}),
|
}),
|
||||||
item => {
|
(item) => {
|
||||||
item[1].active = _.contains(
|
item[1].active = _.contains(
|
||||||
this.model.data.measures,
|
this.model.data.measures,
|
||||||
item[0]
|
item[0]
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ odoo.define("web_pivot_computed_measure.PivotModel", function(require) {
|
|||||||
* @returns a promise
|
* @returns a promise
|
||||||
*/
|
*/
|
||||||
createComputedMeasure: function (id, field1, field2, operation, name, format) {
|
createComputedMeasure: function (id, field1, field2, operation, name, format) {
|
||||||
const measure = _.find(this._computed_measures, item => {
|
const measure = _.find(this._computed_measures, (item) => {
|
||||||
return (
|
return (
|
||||||
item.field1 === field1 &&
|
item.field1 === field1 &&
|
||||||
item.field2 === field2 &&
|
item.field2 === field2 &&
|
||||||
@@ -251,7 +251,7 @@ odoo.define("web_pivot_computed_measure.PivotModel", function(require) {
|
|||||||
toggleMeasure: function (field) {
|
toggleMeasure: function (field) {
|
||||||
if (this._isMeasureEnabled(field)) {
|
if (this._isMeasureEnabled(field)) {
|
||||||
// Measure is disabled
|
// Measure is disabled
|
||||||
const umeasures = _.filter(this._computed_measures, item => {
|
const umeasures = _.filter(this._computed_measures, (item) => {
|
||||||
return item.field1 === field || item.field2 === field;
|
return item.field1 === field || item.field2 === field;
|
||||||
});
|
});
|
||||||
if (umeasures.length && this._isMeasureEnabled(umeasures[0].id)) {
|
if (umeasures.length && this._isMeasureEnabled(umeasures[0].id)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user