[IMP] spreadsheet: improve typing
closes odoo/odoo#103387 Related: odoo/enterprise#32872 Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import spreadsheet from "@spreadsheet/o_spreadsheet/o_spreadsheet_extended";
|
||||
const { coreTypes } = spreadsheet;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import { omit } from "@web/core/utils/objects";
|
||||
/**
|
||||
* @typedef {Object} OdooModelMetaData
|
||||
* @property {string} resModel
|
||||
* @property {Array<Object>|undefined} fields
|
||||
* @property {Array<Field>|undefined} fields
|
||||
*/
|
||||
|
||||
export class OdooViewsDataSource extends LoadableDataSource {
|
||||
@@ -28,7 +28,10 @@ export class OdooViewsDataSource extends LoadableDataSource {
|
||||
this._metaData = JSON.parse(JSON.stringify(params.metaData));
|
||||
/** @protected */
|
||||
this._initialSearchParams = JSON.parse(JSON.stringify(params.searchParams));
|
||||
this._initialSearchParams.context = omit(this._initialSearchParams.context || {}, ...Object.keys(this._orm.user.context));
|
||||
this._initialSearchParams.context = omit(
|
||||
this._initialSearchParams.context || {},
|
||||
...Object.keys(this._orm.user.context)
|
||||
);
|
||||
/** @private */
|
||||
this._customDomain = this._initialSearchParams.domain;
|
||||
}
|
||||
|
||||
+4
-1
@@ -35,6 +35,9 @@ export class DateFilterValue extends Component {
|
||||
return this.period === periodId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Event & { target: HTMLSelectElement }} ev
|
||||
*/
|
||||
onPeriodChanged(ev) {
|
||||
this.period = ev.target.value;
|
||||
this._updateFilter();
|
||||
@@ -58,7 +61,7 @@ DateFilterValue.components = { YearPicker };
|
||||
|
||||
DateFilterValue.props = {
|
||||
// See @spreadsheet_edition/bundle/global_filters/filters_plugin.RangeType
|
||||
type: { validate: (t) => ["year", "month", "quarter"].includes(t) },
|
||||
type: { validate: (/**@type {string} */ t) => ["year", "month", "quarter"].includes(t) },
|
||||
onTimeRangeChanged: Function,
|
||||
yearOffset: { type: Number, optional: true },
|
||||
period: { type: String, optional: true },
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* @property {string} type "text" | "date" | "relation"
|
||||
* @property {RangeType} [rangeType]
|
||||
* @property {boolean} [defaultsToCurrentPeriod]
|
||||
* @property {boolean} [automaticDefaultValue]
|
||||
* @property {string|Array<string>|Object} defaultValue Default Value
|
||||
* @property {number} [modelID] ID of the related model
|
||||
* @property {string} [modelName] Name of the related model
|
||||
@@ -143,7 +144,7 @@ export class GlobalFiltersCorePlugin extends spreadsheet.CorePlugin {
|
||||
/**
|
||||
* Remove a global filter
|
||||
*
|
||||
* @param {number} id Id of the filter to remove
|
||||
* @param {string} id Id of the filter to remove
|
||||
*/
|
||||
_removeGlobalFilter(id) {
|
||||
const globalFilters = { ...this.globalFilters };
|
||||
@@ -153,7 +154,7 @@ export class GlobalFiltersCorePlugin extends spreadsheet.CorePlugin {
|
||||
/**
|
||||
* Edit a global filter
|
||||
*
|
||||
* @param {number} id Id of the filter to update
|
||||
* @param {string} id Id of the filter to update
|
||||
* @param {GlobalFilter} newFilter
|
||||
*/
|
||||
_editGlobalFilter(id, newFilter) {
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
/** @odoo-module */
|
||||
|
||||
/**
|
||||
* Requires to have the file o_spreadsheet.d.ts included in the file tsconfig.json
|
||||
* See https://github.com/odoo/odoo/blob/16.0/addons/web/tooling/types/readme.md
|
||||
*/
|
||||
/** @type {o_spreadsheet} */
|
||||
const spreadsheet = window.o_spreadsheet;
|
||||
export const initCallbackRegistry = new spreadsheet.Registry();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user