Skip to content

Commit

Permalink
[MIG] spreadsheet_oca: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
FernandoRomera committed Jul 30, 2024
1 parent ae924b6 commit a2306cb
Show file tree
Hide file tree
Showing 22 changed files with 396 additions and 228 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Do NOT update manually; changes here will be overwritten by Copier
_commit: v1.21.1
_commit: v1.24
_src_path: https://github.com/OCA/oca-addons-repo-template.git
additional_ruff_rules: []
ci: GitHub
Expand Down
188 changes: 188 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
env:
browser: true
es6: true

# See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449
parserOptions:
ecmaVersion: 2022

overrides:
- files:
- "**/*.esm.js"
parserOptions:
sourceType: module

# Globals available in Odoo that shouldn't produce errorings
globals:
_: readonly
$: readonly
fuzzy: readonly
jQuery: readonly
moment: readonly
odoo: readonly
openerp: readonly
owl: readonly
luxon: readonly

# Styling is handled by Prettier, so we only need to enable AST rules;
# see https://github.com/OCA/maintainer-quality-tools/pull/618#issuecomment-558576890
rules:
accessor-pairs: warn
array-callback-return: warn
callback-return: warn
capitalized-comments:
- warn
- always
- ignoreConsecutiveComments: true
ignoreInlineComments: true
complexity:
- warn
- 15
constructor-super: warn
dot-notation: warn
eqeqeq: warn
global-require: warn
handle-callback-err: warn
id-blacklist: warn
id-match: warn
init-declarations: error
max-depth: warn
max-nested-callbacks: warn
max-statements-per-line: warn
no-alert: warn
no-array-constructor: warn
no-caller: warn
no-case-declarations: warn
no-class-assign: warn
no-cond-assign: error
no-const-assign: error
no-constant-condition: warn
no-control-regex: warn
no-debugger: error
no-delete-var: warn
no-div-regex: warn
no-dupe-args: error
no-dupe-class-members: error
no-dupe-keys: error
no-duplicate-case: error
no-duplicate-imports: error
no-else-return: warn
no-empty-character-class: warn
no-empty-function: error
no-empty-pattern: error
no-empty: warn
no-eq-null: error
no-eval: error
no-ex-assign: error
no-extend-native: warn
no-extra-bind: warn
no-extra-boolean-cast: warn
no-extra-label: warn
no-fallthrough: warn
no-func-assign: error
no-global-assign: error
no-implicit-coercion:
- warn
- allow: ["~"]
no-implicit-globals: warn
no-implied-eval: warn
no-inline-comments: warn
no-inner-declarations: warn
no-invalid-regexp: warn
no-irregular-whitespace: warn
no-iterator: warn
no-label-var: warn
no-labels: warn
no-lone-blocks: warn
no-lonely-if: error
no-mixed-requires: error
no-multi-str: warn
no-native-reassign: error
no-negated-condition: warn
no-negated-in-lhs: error
no-new-func: warn
no-new-object: warn
no-new-require: warn
no-new-symbol: warn
no-new-wrappers: warn
no-new: warn
no-obj-calls: warn
no-octal-escape: warn
no-octal: warn
no-param-reassign: warn
no-path-concat: warn
no-process-env: warn
no-process-exit: warn
no-proto: warn
no-prototype-builtins: warn
no-redeclare: warn
no-regex-spaces: warn
no-restricted-globals: warn
no-restricted-imports: warn
no-restricted-modules: warn
no-restricted-syntax: warn
no-return-assign: error
no-script-url: warn
no-self-assign: warn
no-self-compare: warn
no-sequences: warn
no-shadow-restricted-names: warn
no-shadow: warn
no-sparse-arrays: warn
no-sync: warn
no-this-before-super: warn
no-throw-literal: warn
no-undef-init: warn
no-undef: error
no-unmodified-loop-condition: warn
no-unneeded-ternary: error
no-unreachable: error
no-unsafe-finally: error
no-unused-expressions: error
no-unused-labels: error
no-unused-vars: error
no-use-before-define: error
no-useless-call: warn
no-useless-computed-key: warn
no-useless-concat: warn
no-useless-constructor: warn
no-useless-escape: warn
no-useless-rename: warn
no-void: warn
no-with: warn
operator-assignment: [error, always]
prefer-const: warn
radix: warn
require-yield: warn
sort-imports: warn
spaced-comment: [error, always]
strict: [error, function]
use-isnan: error
valid-jsdoc:
- warn
- prefer:
arg: param
argument: param
augments: extends
constructor: class
exception: throws
func: function
method: function
prop: property
return: returns
virtual: abstract
yield: yields
preferType:
array: Array
bool: Boolean
boolean: Boolean
number: Number
object: Object
str: String
string: String
requireParamDescription: false
requireReturn: false
requireReturnDescription: false
requireReturnType: false
valid-typeof: warn
yoda: warn
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ var/
*.egg
*.eggs

# Debian packages
*.deb

# Redhat packages
*.rpm

# MacOS packages
*.dmg

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ repos:
hooks:
- id: whool-init
- repo: https://github.com/oca/maintainer-tools
rev: 9a170331575a265c092ee6b24b845ec508e8ef75
rev: d5fab7ee87fceee858a3d01048c78a548974d935
hooks:
# update the NOT INSTALLABLE ADDONS section above
- id: oca-update-pre-commit-excluded-addons
Expand Down
2 changes: 1 addition & 1 deletion spreadsheet_oca/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Spreadsheet Oca",
"summary": """
Allow to edit spreadsheets""",
"version": "16.0.1.3.0",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"author": "CreuBlanca,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/spreadsheet",
Expand Down
3 changes: 2 additions & 1 deletion spreadsheet_oca/models/ir_websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def _build_bus_channel_list(self, channels):
model_name, "read", raise_exception=False
):
continue

Check warning on line 45 in spreadsheet_oca/models/ir_websocket.py

View check run for this annotation

Codecov / codecov/patch

spreadsheet_oca/models/ir_websocket.py#L45

Added line #L45 was not covered by tests
# If user don't have access to the model, we don't even try to read
# If user don't have access to the model, we don't
# even try to read

document = self.env[model_name].search(

Check warning on line 49 in spreadsheet_oca/models/ir_websocket.py

View check run for this annotation

Codecov / codecov/patch

spreadsheet_oca/models/ir_websocket.py#L49

Added line #L49 was not covered by tests
[("id", "=", res_id)], limit=1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class SpreadsheetSpreadsheetImportMode(models.Model):
_name = "spreadsheet.spreadsheet.import.mode"
_description = "Import Mode"
_order = "sequence asc"
_order = "sequence asc, id"
_rec_name = "name"

sequence = fields.Integer(default=20)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/** @odoo-module */

import { patch } from "@web/core/utils/patch";
import spreadsheet from "@spreadsheet/o_spreadsheet/o_spreadsheet_extended";
import * as spreadsheet from "@odoo/o-spreadsheet";
const { chartRegistry } = spreadsheet.registries;

const { ChartPanel } = spreadsheet.components;
export function isOdooKey(code) {
return code.startsWith("odoo_");
}

patch(ChartPanel.prototype, "spreadsheet_oca.ChartPanel", {
patch(ChartPanel.prototype, {
get chartTypes() {
return this.filterChartTypes(isOdooKey(this.getChartDefinition().type));
},
Expand Down
20 changes: 4 additions & 16 deletions spreadsheet_oca/static/src/spreadsheet/bundle/chart_panels.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { Domain } from "@web/core/domain";
import { Many2OneField } from "@web/views/fields/many2one/many2one_field";
import { patch } from "@web/core/utils/patch";
import spreadsheet from "@spreadsheet/o_spreadsheet/o_spreadsheet_extended";
import * as spreadsheet from "@odoo/o-spreadsheet";
import { useService } from "@web/core/utils/hooks";

const {
Expand Down Expand Up @@ -54,31 +54,19 @@ const menuChartProps = {
},
};

patch(
LineBarPieConfigPanel.prototype,
"spreadsheet_oca.LineBarPieConfigPanel",
menuChartProps
);
patch(LineBarPieConfigPanel.prototype, menuChartProps);
LineBarPieConfigPanel.components = {
...LineBarPieConfigPanel.components,
Many2OneField,
};

patch(
ScorecardChartConfigPanel.prototype,
"spreadsheet_oca.ScorecardChartConfigPanel",
menuChartProps
);
patch(ScorecardChartConfigPanel.prototype, menuChartProps);
ScorecardChartConfigPanel.components = {
...ScorecardChartConfigPanel.components,
Many2OneField,
};

patch(
GaugeChartConfigPanel.prototype,
"spreadsheet_oca.GaugeChartConfigPanel",
menuChartProps
);
patch(GaugeChartConfigPanel.prototype, menuChartProps);
GaugeChartConfigPanel.components = {
...GaugeChartConfigPanel.components,
Many2OneField,
Expand Down
4 changes: 2 additions & 2 deletions spreadsheet_oca/static/src/spreadsheet/bundle/filter.esm.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/** @odoo-module **/

import { Component, onWillStart, useState } from "@odoo/owl";
import { _lt, _t } from "web.core";
import { _lt, _t } from "@web/core/l10n/translation";

import { FilterValue } from "@spreadsheet/global_filters/components/filter_value/filter_value";
import { ModelFieldSelector } from "@web/core/model_field_selector/model_field_selector";
import { ModelSelector } from "@web/core/model_selector/model_selector";
import { RELATIVE_DATE_RANGE_TYPES } from "@spreadsheet/helpers/constants";
import { globalFiltersFieldMatchers } from "@spreadsheet/global_filters/plugins/global_filters_core_plugin";
import spreadsheet from "@spreadsheet/o_spreadsheet/o_spreadsheet_extended";
import * as spreadsheet from "@odoo/o-spreadsheet";
import { useService } from "@web/core/utils/hooks";

const { topbarMenuRegistry } = spreadsheet.registries;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { Component, onWillStart, onWillUpdateProps } from "@odoo/owl";
import { Domain } from "@web/core/domain";
import { DomainSelector } from "@web/core/domain_selector/domain_selector";
import { DomainSelectorDialog } from "@web/core/domain_selector_dialog/domain_selector_dialog";
import { _t } from "web.core";
import spreadsheet from "@spreadsheet/o_spreadsheet/o_spreadsheet_extended";
import { time_to_str } from "web.time";
import { _t } from "@web/core/l10n/translation";
import * as spreadsheet from "@odoo/o-spreadsheet";
import { formatDateTime } from "@web/core/l10n/dates";
import { useService } from "@web/core/utils/hooks";
import { FormViewDialog } from "@web/views/view_dialogs/form_view_dialog";
import { makeDynamicRows } from "../utils/dynamic_row_generator.esm";
Expand Down Expand Up @@ -87,7 +87,7 @@ export class PivotPanelDisplay extends Component {
get lastUpdate() {
const lastUpdate = this.PivotDataSource.lastUpdate;
if (lastUpdate) {
return time_to_str(new Date(lastUpdate));
return formatDateTime(new Date(lastUpdate), { format: "HH:mm:ss" });
}
return _t("not updated");
}
Expand Down Expand Up @@ -214,7 +214,7 @@ export class ListPanelDisplay extends Component {
get lastUpdate() {
const lastUpdate = this.ListDataSource.lastUpdate;
if (lastUpdate) {
return time_to_str(new Date(lastUpdate));
return formatDateTime(new Date(lastUpdate), { format: "HH:mm:ss" });
}
return _t("not updated");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { Domain } from "@web/core/domain";
import { Many2OneField } from "@web/views/fields/many2one/many2one_field";
import spreadsheet from "@spreadsheet/o_spreadsheet/o_spreadsheet_extended";
import * as spreadsheet from "@odoo/o-spreadsheet";
import { useService } from "@web/core/utils/hooks";

const { chartSidePanelComponentRegistry } = spreadsheet.registries;
Expand Down
Loading

0 comments on commit a2306cb

Please sign in to comment.